.issues-page {
  padding: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
}

.issues-hero {
  margin-bottom: 1.25rem;
}

.back-link {
  font-size: 0.85rem;
  color: #6c757d;
  text-decoration: none;
}

.back-link:hover {
  color: #0d6efd;
  text-decoration: underline;
}

/* Stats section */
.stats-section {
  margin-bottom: 1.25rem;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.stat-card--open  { border-top: 3px solid #dc3545; }
.stat-card--fixed { border-top: 3px solid #198754; }
.stat-card--trend { border-top: 3px solid #ffc107; }

.stat-card--chart {
  border-top: 3px solid #6f42c1;
  flex: 1 1 260px;
  min-width: 260px;
  align-items: stretch;
  padding: 1rem;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 180px;
}

/* Bootstrap doesn't ship a purple badge variant — add one for PREFLIGHT_CHECK_FAILED */
.badge.bg-purple {
  background-color: #6f42c1 !important;
  color: #fff;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.35rem;
  text-align: center;
}

/* Short qualifiers for stat-card counting semantics. */
.stat-caveat {
  font-size: 0.65rem;
  color: #adb5bd;
  font-style: italic;
  margin-top: 0.15rem;
  text-align: center;
  cursor: help;
}

/* Filter card */
.filter-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}

/* Section heading */
.section-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.4rem;
}

/* When the heading sits inline with the search bar the border-bottom
   only belongs on the heading itself, not a full-width rule. */
.issues-section > .d-flex > .section-heading {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Search input — keep the left icon border seamless */
#open-issues-search:focus {
  box-shadow: none;
  border-color: #dee2e6;
}

#open-issues-search + .input-group-text,
.input-group:focus-within .input-group-text {
  border-color: #86b7fe;
}

.issues-section {
  margin-bottom: 2rem;
}

/* Type group */
.type-group__heading {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

/* Region group */
.region-group__heading {
  margin-bottom: 0.5rem;
}

/* Issue card */
.issue-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.issue-card--reopened {
  border-left: 3px solid #ffc107;
}

/* Top row: header + actions side-by-side */
.issue-card__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.issue-card__header {
  flex: 1;
  min-width: 0;
}

.issue-card__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.issue-card__title {
  font-weight: 500;
  font-size: 0.9rem;
}

.issue-card__reopened-badge {
  font-size: 0.7rem;
}

.issue-card__meta {
  font-size: 0.8rem;
}

.issue-card__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Inline notes under the card header */
.issue-card__notes {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px dashed #e9ecef;
}

/* Hide the notes section entirely when empty (no border, no gap) */
.issue-card__notes:empty {
  display: none;
}

.issue-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.issue-note-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.2rem 0;
  border-bottom: 1px dotted #f0f0f0;
}

.issue-note-item:last-child {
  border-bottom: none;
}

.issue-note-item::before {
  content: "📝";
  font-size: 0.75rem;
  flex-shrink: 0;
}

.issue-note-text {
  flex: 1;
  color: #495057;
}

.issue-note-ts {
  color: #adb5bd;
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Closed issues table */
.table-card {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  overflow: hidden;
}

.issues-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  vertical-align: middle;
}

.issues-table td {
  vertical-align: middle;
  font-size: 0.875rem;
}

.title-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-cell {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timestamp-cell {
  white-space: nowrap;
  font-size: 0.8rem;
  color: #555;
}

/* Details modal */
.detail-section-heading {
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.4rem;
}

.detail-pre {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.75rem;
  font-size: 0.8rem;
  overflow-x: auto;
  max-height: 200px;
}

.history-entry,
.note-entry {
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.history-entry:last-child,
.note-entry:last-child {
  border-bottom: none;
}
