/*
 * Folder matches: a quiet, location-first review of verified scan results.
 * Load after the existing scanner and acceptance styles.
 */

#folder-matches-list {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 14px 0;
}

#folder-matches-list .folder-match-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #fbfcfb;
  color: #182b29;
}

#folder-matches-list .folder-match-card h2 {
  margin: 0 0 7px;
  color: #182b29;
  font-size: 19px;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#folder-matches-list .folder-match-card > p {
  max-width: 76ch;
  margin: 5px 0;
  color: #52675b;
  font-size: 15px;
  line-height: 1.5;
}

/* Classification markers remain descriptive, not alarm-like. */
#folder-matches-list .folder-match-card[data-kind="identical"] {
  border-left: 4px solid #39734e;
  background: #f5faf6;
}

#folder-matches-list .folder-match-card[data-kind="additional"] {
  border-left: 4px solid #789685;
}

#folder-matches-list .folder-match-card[data-kind="renamed"] {
  border-left: 4px solid #a9b8ad;
}

#folder-matches-list .folder-match-card[data-kind="organised"] {
  border-left: 4px solid #c2cec5;
}

#folder-matches-list .folder-participants {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 9px;
  margin: 13px 0;
}

#folder-matches-list .folder-participant {
  position: relative;
  min-width: 0;
  padding: 10px 11px 10px 36px;
  border: 1px solid #dce6df;
  border-radius: 6px;
  background: #fff;
}

#folder-matches-list .folder-participant::before {
  position: absolute;
  top: 15px;
  left: 12px;
  width: 16px;
  height: 12px;
  border: 1.5px solid #547965;
  border-radius: 2px;
  background: #eaf4ee;
  content: "";
}

#folder-matches-list .folder-participant::after {
  position: absolute;
  top: 11px;
  left: 14px;
  width: 7px;
  height: 4px;
  border: 1.5px solid #547965;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #eaf4ee;
  content: "";
}

#folder-matches-list .folder-location {
  margin: 0;
  color: #182b29;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#folder-matches-list .folder-participant p,
#folder-matches-list .folder-participant .folder-counts,
#folder-matches-list .folder-participant .folder-facts {
  margin: 3px 0 0;
  color: #52675b;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#folder-matches-list .folder-warning {
  margin: 10px 0;
  padding: 9px 11px;
  border-left: 3px solid #aebdb2;
  border-radius: 3px;
  background: #f2f6f3;
  color: #40574a;
  font-size: 14px;
  line-height: 1.5;
}

#folder-matches-list .folder-differences {
  display: grid;
  gap: 12px;
  margin: 13px 0;
}

#folder-matches-list .difference-group {
  min-width: 0;
}

#folder-matches-list .difference-group > h3,
#folder-matches-list .difference-group > p {
  margin: 0 0 7px;
  color: #40574a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

#folder-matches-list .difference-side {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #e0e8e2;
  border-radius: 6px;
  background: #f7f9f8;
}

/* Reuse the compact folder-first member records used in the existing results. */
#folder-matches-list .difference-side .folder-file,
#folder-matches-list .difference-side > .member-card,
#folder-matches-list .folder-detail-list .folder-file {
  min-width: 0;
}

#folder-matches-list .difference-side .member-card,
#folder-matches-list .folder-detail-list .member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 10px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #e0e8e2;
  border-radius: 5px;
  background: #fff;
}

#folder-matches-list .member-title-line {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 7px;
  min-width: 0;
  line-height: 1.35;
}

#folder-matches-list .file-type-icon {
  flex: 0 0 auto;
  color: #52675b;
  font-size: 14px;
}

#folder-matches-list .member-hierarchy {
  min-width: 0;
  color: #52675b;
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

#folder-matches-list .member-hierarchy strong {
  font-weight: 750;
}

#folder-matches-list .member-name {
  color: #182b29;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#folder-matches-list .member-detail-line {
  display: flex;
  grid-column: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  min-width: 0;
  margin: 0;
  color: #52675b;
  font-size: 14px;
  line-height: 1.4;
}

#folder-matches-list .member-actions {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

#folder-matches-list .member-actions .copy-action,
#folder-matches-list .member-actions .view-copies {
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid #aabdb1;
  border-radius: 5px;
  background: #f7faf8;
  color: #245a43;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#folder-matches-list .member-actions .copy-action:hover,
#folder-matches-list .member-actions .view-copies:hover {
  background: #eaf4ee;
}

#folder-matches-list .member-actions .copy-action.success {
  border-color: #245a43;
  background: #245a43;
  color: #fff;
}

#folder-matches-list .member-feedback:empty {
  display: none;
}

#folder-matches-list .member-feedback[role="status"] {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
  color: #245a43;
  font-size: 14px;
  line-height: 1.35;
}

#folder-matches-list details.folder-detail-list {
  margin-top: 12px;
  border: 1px solid #d8e2dc;
  border-radius: 6px;
  background: #fff;
}

#folder-matches-list details.folder-detail-list > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 12px;
  color: #245a43;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

#folder-matches-list details.folder-detail-list > summary::-webkit-details-marker {
  display: none;
}

#folder-matches-list details.folder-detail-list > summary::before {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #52675b;
  border-bottom: 2px solid #52675b;
  content: "";
  transform: rotate(-45deg);
  transition: transform 140ms ease;
}

#folder-matches-list details.folder-detail-list[open] > summary::before {
  transform: translateY(-2px) rotate(45deg);
}

#folder-matches-list .folder-detail-list-content {
  display: grid;
  gap: 5px;
  padding: 0 10px 10px;
}

#folder-matches-list .folder-detail-pagination,
#folder-matches-list .folder-match-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px 10px;
  margin: 12px 0 2px;
  color: #52675b;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

#folder-matches-list .folder-detail-pagination button,
#folder-matches-list .folder-match-pagination button {
  min-height: 36px;
}

#folder-analysis-summary {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid #b7d1bd;
  border-left: 4px solid #39734e;
  border-radius: 7px;
  background: #eaf4ee;
  color: #234d35;
  font-size: 16px;
  line-height: 1.55;
}

#folder-analysis-summary a,
#folder-analysis-summary .button,
#folder-analysis-summary button {
  color: #245a43;
}

#folder-analysis-summary .button,
#folder-analysis-summary button {
  min-height: 40px;
  margin: 8px 5px 0 0;
}

#folder-analysis-warning {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #e3d1ac;
  border-left: 4px solid #a45b16;
  border-radius: 6px;
  background: #fbf6ea;
  color: #59472d;
  font-size: 15px;
  line-height: 1.55;
}

#folder-matches-list :where(button, summary, a, [tabindex]):focus-visible,
#folder-analysis-summary :where(button, summary, a, [tabindex]):focus-visible,
#folder-analysis-warning :where(button, summary, a, [tabindex]):focus-visible {
  outline: 3px solid #a45b16;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #f7f9f8;
}

@media (max-width: 680px) {
  #folder-matches-list .folder-match-card {
    padding: 13px;
  }

  #folder-matches-list .folder-participants {
    grid-template-columns: minmax(0, 1fr);
  }

  #folder-matches-list .difference-side .member-card,
  #folder-matches-list .folder-detail-list .member-card {
    grid-template-columns: minmax(0, 1fr);
  }

  #folder-matches-list .member-detail-line,
  #folder-matches-list .member-actions {
    grid-column: 1;
  }

  #folder-matches-list .member-actions {
    grid-row: auto;
    justify-content: flex-start;
  }

  #folder-analysis-summary,
  #folder-analysis-warning {
    padding: 12px;
  }
}

.folder-report-table{width:100%;border-collapse:collapse;font-size:10pt}
.folder-report-table td,.folder-report-table th{padding:5px;border:1px solid #aaa;text-align:left;vertical-align:top;overflow-wrap:anywhere}
.folder-report-table tr{break-inside:avoid}
.folder-report-table th:nth-child(1){width:23%}
.folder-report-table th:nth-child(2){width:30%}
.folder-report-table th:nth-child(3){width:20%}
.folder-report-table th:nth-child(4){width:27%}
@media (prefers-reduced-motion: reduce) {
  #folder-matches-list details.folder-detail-list > summary::before {
    transition: none;
  }
}
