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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #eef2f6;
  color: #0f172a;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[x-cloak] {
  display: none !important;
}

#disclaimer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(700px, calc(100% - 32px));
  text-align: center;
  font-weight: 700;
  background: #dc2626;
  padding: 6px 12px;
  border-radius: 10px;
  color: #ffffff;
  z-index: 50;
}

.dashboard {
  min-height: 100vh;
  height: 100vh;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dashboard-header {
  display: flex;
  height: calc(10vh - 15px * 2);
}

.dashboard-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-header__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}

.dashboard-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-start;
}

.month-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
}

.month-switcher button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #1f2937;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.2s;
}

.month-switcher button:hover {
  background: rgba(37, 99, 235, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
  background: #ffffff;
  color: #1f2937;
}

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

.btn-primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1b46c0;
  border-color: #1b46c0;
}

.btn__hint {
  font-size: 12px;
  color: #64748b;
}

.btn-muted {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1f2937;
}

.btn-muted:hover {
  background: #e2e8f0;
}

.btn-compact {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.form-select,
.form-input,
.form-textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.4;
  min-height: 32px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select--wide {
  min-width: 180px;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1f2937;
}

.control-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.info-line {
  font-size: 14px;
  color: #475569;
}

.info-highlight {
  font-weight: 600;
  color: #0f172a;
}

.summary-grid {
  display: flex;
  flex-direction: row;
  gap: 5px;
}

.summary-grid-container {
  display: flex;
  justify-content: space-between;
}

.summary-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.summary-card__label {
  font-size: 10px;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
}

.summary-card__value {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.summary-card__note {
  font-size: 12px;
  color: #64748b;
  display: none;
  /* ADD AS HOVER */
}

.alert-card {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  width: 300px;
}

.notice-card {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  color: #0c4a6e;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
}

.notice-card--preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.notice-card__body {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.notice-card__actions {
  display: flex;
  gap: 8px;
}

.alert-card__actions {
  display: none;
}

.alert-card__toggle {
  background: none;
  border: none;
  font-size: 12px;
  color: #92400e;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.alert-card__textarea {
  margin-top: 10px;
  width: 100%;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  background: #ffffff;
  color: #92400e;
}

.dashboard-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.data-browser {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: min(70vh, 720px);
  min-height: 360px;
  width: calc(100vw - 15px * 2);
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  justify-content: center;
}

.filter-toolbar__search {
  width: 200px;
}

.filter-toolbar__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.dropdown-menu__footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  font-size: 12px;
  color: #475569;
}

.dropdown-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1f2937;
}

.flag-toggle {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.flag-toggle:hover {
  border-color: #94a3b8;
}

.flag-toggle.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#data-browser {
  flex: 1;
  min-height: 0;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.insights-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.insights-panel canvas {
  flex: 0 0 auto;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 12px;
}

.settings-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: #00000030 0 10px 24px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-tabs {
  display: inline-flex;
  gap: 8px;
}

.settings-tabs .btn.is-active {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #1f2937;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-error {
  color: #dc2626;
  font-size: 12px;
  margin: 0;
}

.btn-alert {
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35);
}

.control-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #475569;
}

.control-info__alert {
  color: #dc2626;
  font-weight: 600;
}

.control-info__note {
  color: #64748b;
}

.col-suggestion {
  background: #fef3c7;
}

.suggestion-cell {
  height: 100%;
}

.tabulator-cell.suggestion-cell {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
}

.tabulator-cell.suggestion-cell--empty {
  background: #f8fafc;
  color: #475569;
  font-weight: 500;
}

.tabulator-cell.suggestion-cell--warning {
  color: #b91c1c;
}

.tabulator-cell.suggestion-cell--stale {
  box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.25);
}

.suggestion-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  max-width: 340px;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.35);
}

.cv-empty-state {
  font-size: 12px;
  color: #475569;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
}

.cv-inline {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cv-inline__title {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}

.cv-inline__rows {
  display: flex;
  flex-direction: column;
}

.cv-inline__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.cv-inline__bucket {
  font-weight: 600;
  font-size: 12px;
  color: #1d4ed8;
  text-transform: capitalize;
}

.cv-inline__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cv-inline__metric {
  display: flex;
  gap: 4px;
  font-size: 12px;
  color: #334155;
  align-items: baseline;
}

.cv-inline__metric-label {
  font-weight: 500;
  color: #64748b;
}

.cv-inline__metric-label::after {
  content: ":";
  margin-left: 1px;
}

.cv-inline__metric-value {
  font-weight: 600;
  color: #0f172a;
  margin-left: 2px;
}

.cv-inline__separator {
  color: #94a3b8;
}

.source-cell {
  position: relative;
  height: 100%;
}

.tabulator-cell .source-cell {
  white-space: normal;
}

.source-cell--status-tt {
  border: 1px solid #facc15;
  background: #fef9c3;
}

.source-cell--status-pt {
  border: 1px solid #f87171;
  background: #fee2e2;
}

.source-cell--changed {
  box-shadow: inset 0 0 0 1px #2563eb;
}

.source-cell--empty {
  color: #9ca3af;
  text-align: center;
  font-size: 12px;
}

.source-cell__price {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.source-cell__description {
  font-size: 11px;
  color: #1f2937;
  margin-top: 2px;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.source-cell__status-badge {
  position: absolute;
      top: 2px;
    right: 43px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 9999px;
  background: #1d4ed8;
  color: #fff;
  letter-spacing: 0.05em;
}

.source-cell--status-tt .source-cell__status-badge {
  background: #d97706;
}

.source-cell--status-pt .source-cell__status-badge {
  background: #b91c1c;
}

.source-cell__change-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #2563eb;
}

.source-cell__pct-change {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 10px;
  font-weight: 600;
}

.source-cell__diff,
.source-cell__margin {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
}

.source-cell__margin {
  color: #2563eb;
}

.source-cell__sku {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  color: #475569;
  width: max-content;
}

.brand-cell {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 52px;
  padding: 2px 0;
  white-space: normal;
}

.brand-cell--empty {
  align-items: center;
  justify-items: center;
  color: #94a3b8;
  font-size: 12px;
}

.brand-cell__reference {
  display: grid;
  gap: 3px;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}

.brand-cell--reference-only .brand-cell__reference {
  border-style: dashed;
}

.brand-cell__reference-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-cell__part {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.brand-cell__description {
  color: #64748b;
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.brand-cell__empty-state {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.brand-cell__listing {
  display: grid;
  grid-template-columns: minmax(54px, 0.8fr) auto;
  gap: 2px 6px;
  align-items: baseline;
  padding: 4px 5px;
  border-radius: 5px;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
}

.brand-cell__listing--primary {
  border-left-color: #2563eb;
  background: #eff6ff;
}

.brand-cell__listing--tt {
  border-left-color: #d97706;
  background: #fffbeb;
}

.brand-cell__listing--pt {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.brand-cell__listing--changed {
  box-shadow: inset 0 0 0 1px #2563eb;
}

.brand-cell__source {
  min-width: 0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-cell__price {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.brand-cell__sku {
  grid-column: 1 / -1;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.row-details {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

.detail-grid__actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.detail-grid table {
  width: 100%;
  border-collapse: collapse;
}

.detail-grid table th,
.detail-grid table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 4px 8px;
  text-align: left;
  font-size: 12px;
}

.badge {
  display: inline-block;
  background: #e0f2fe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-right: 4px;
  margin-bottom: 4px;
}

.badge--warning {
  background: #fff7ed;
  color: #c2410c;
}

.badge--danger {
  background: #fef2f2;
  color: #b91c1c;
}

.badge--success {
  background: #ecfdf5;
  color: #166534;
}

.badge--neutral {
  background: #f1f5f9;
  color: #475569;
}

.review-signal-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 30px;
}

.review-signal-cell--empty {
  color: #94a3b8;
}

.detail-signal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-signal {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
}

.detail-signal--warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.detail-signal--danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.detail-signal--success {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.detail-signal__header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.detail-signal__source {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.detail-signal p {
  margin: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
}

.detail-list-empty {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.tabulator-action-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tabulator-action-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.tabulator-action-btn--muted {
  background: #f8fafc;
  color: #334155;
}

.tabulator-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.group-editor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 70;
}

.group-history-launcher {
  position: fixed;
  left: 20px;
  bottom: 20px;
  min-width: 136px;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  z-index: 85;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
}

.group-history-launcher:hover {
  background: #1e293b;
}

.group-history-launcher svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.group-history-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(430px, calc(100vw - 32px));
  height: 100vh;
  background: #ffffff;
  z-index: 80;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.group-history-drawer.is-open {
  transform: translateX(0);
}

.group-editor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, calc(100vw - 32px));
  height: 100vh;
  background: #ffffff;
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.18);
  z-index: 80;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.group-editor-drawer.is-open {
  transform: translateX(0);
}

.group-history-drawer__header,
.group-editor-drawer__header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.group-editor-drawer__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 700;
}

.group-editor-drawer__header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.group-editor-drawer__subtitle {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
}

.group-editor-drawer__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.group-editor-drawer__body {
  padding: 18px 20px 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-gutter: stable;
}

.group-editor-drawer__state {
  padding: 24px 20px;
  color: #475569;
}

.group-editor-drawer__state--error {
  color: #b91c1c;
}

.group-editor-drawer__message {
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  color: #166534;
  font-size: 13px;
  font-weight: 500;
}

.group-editor-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-editor-section__hint {
  margin: -4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.group-editor-section__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.group-editor-section__header h3 {
  margin: 0;
  font-size: 15px;
}

.group-editor-source-list,
.group-editor-flag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-editor-source-chip,
.group-editor-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.group-editor-source-chip {
  background: #eef2ff;
  color: #3730a3;
}

.group-editor-source-chip.is-self {
  background: #dcfce7;
  color: #166534;
}

.group-editor-source-chip--missing {
  background: #f8fafc;
  color: #475569;
  border: 1px dashed #cbd5e1;
}

.group-editor-flag {
  background: #fff7ed;
  color: #c2410c;
}

.group-editor-form {
  display: grid;
  gap: 12px;
}

.group-editor-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-editor-add {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.group-editor-add__search {
  position: relative;
  flex: 1;
}

.group-editor-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.15);
  max-height: 240px;
  overflow: auto;
  padding: 6px;
}

.group-editor-search-results__item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-editor-search-results__item:hover {
  background: #f8fafc;
}

.group-editor-search-results__primary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}

.group-editor-search-results__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 700;
}

.group-editor-search-results__meta,
.group-editor-member__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #64748b;
  font-size: 12px;
}

.group-editor-search-results__status {
  padding: 8px 10px;
  color: #475569;
  font-size: 13px;
}

.group-editor-search-results__status--error {
  color: #b91c1c;
}

.group-editor-inline-message {
  margin: 0;
  font-size: 13px;
  color: #475569;
}

.group-editor-members {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.group-editor-member-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-editor-member-group__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.group-editor-member-group__header h4 {
  margin: 0;
  font-size: 14px;
  color: #0f172a;
}

.group-editor-member-group__header span {
  font-size: 12px;
  color: #64748b;
}

.group-editor-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  color: #64748b;
  font-size: 13px;
  background: #f8fafc;
}

.group-editor-member {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}

.group-editor-member--self {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.group-editor-member__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-editor-member__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.group-editor-member__name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.group-history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding-left: 16px;
}

.group-history-list::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 2px;
  background: #94a3b8;
}

.group-history-card {
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  padding: 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.group-history-card::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -17px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #94a3b8;
  border: 5px solid #eef2f6;
}

.group-history-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #cbd5e1;
}

.group-history-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-history-card__identity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: #64748b;
  min-width: 0;
}

.group-history-card__type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #2563eb;
  font-weight: 700;
}

.group-history-card__identity strong {
  color: #0f172a;
  font-size: 15px;
}

.group-history-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-history-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.group-history-card__badge--positive {
  background: #dcfce7;
  color: #166534;
}

.group-history-card__badge--warning {
  background: #fff7ed;
  color: #c2410c;
}

.group-history-card__badge--accent {
  background: #dbeafe;
  color: #1d4ed8;
}

.group-history-card__badge--neutral {
  background: #eef2ff;
  color: #4338ca;
}

.group-history-card__badge--muted {
  background: #e2e8f0;
  color: #475569;
}

.group-history-card__note {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.group-history-card__changes {
  display: grid;
  gap: 10px;
}

.group-history-card__change {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-history-card__change--category {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.group-history-card__change--added {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.group-history-card__change--removed {
  background: #fff7ed;
  border-color: #fed7aa;
}

.group-history-card__change--restore {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.group-history-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  font-weight: 700;
}

.group-history-card__change strong {
  color: #0f172a;
}

.group-history-card__flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #0f172a;
}

.group-history-card__token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-history-card__token {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #334155;
  font-size: 11px;
  font-weight: 600;
}

.group-history-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(226, 232, 240, 0.85);
}

.group-history-card--restore::before {
  background: #2563eb;
}

.group-history-card--restore::after {
  background: #1d4ed8;
}

.group-history-card--add_member::before,
.group-history-card--create::before {
  background: #15803d;
}

.group-history-card--add_member::after,
.group-history-card--create::after {
  background: #15803d;
}

.group-history-card--remove_member::before {
  background: #c2410c;
}

.group-history-card--remove_member::after {
  background: #c2410c;
}

@media (max-width: 1200px) {
  .dashboard-body {
    grid-template-columns: 1fr;
  }

  .insights-panel {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .insights-panel canvas {
    flex: 1 1 300px;
  }

  #category-changes {
    flex: 1 1 300px;
  }
}

@media (max-width: 768px) {
  .dashboard {
    padding: 16px;
  }

  .dashboard-header__row {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-body {
    gap: 12px;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-toolbar__search {
    width: 100%;
  }

  .dropdown-menu {
    right: auto;
    left: 0;
  }

  .group-history-drawer,
  .group-editor-drawer {
    width: 100vw;
  }

  .group-history-launcher {
    left: 16px;
    bottom: 16px;
  }

  .group-history-drawer__header,
  .group-editor-drawer__header {
    flex-direction: column;
  }

  .group-editor-add,
  .group-editor-member {
    flex-direction: column;
  }

  .group-history-list {
    padding-left: 14px;
  }

  .group-history-card::before {
    left: -15px;
  }
}
