/* Global Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  color: #222;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Accessibility: Screen Reader Only Text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Accessibility: Skip Navigation Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #cc0000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  border-radius: 0 0 4px 0;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Header */
header {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
  color: #fff;
  /* Increase bottom padding slightly to avoid overlap with following content */
  padding: 1.5rem 1rem 2rem 1rem;
  /* MODIFIED FOR BRANDING */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* END MODIFICATION */
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
 
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  /* Smooth transitions for shrink-on-scroll */
  transition: padding 0.2s ease, transform 0.3s ease, opacity 0.3s ease, box-shadow 0.2s ease;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform, opacity, box-shadow;
}

/* Header visibility states */
header.header--visible {
  transform: translateY(0);
  opacity: 1;
}

header.header--hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* --- NEW BRANDING STYLES --- */
.branding-link {
  text-decoration: none;
  color: #fff;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.branding-link:hover {
  background: rgba(0,0,0,0.1);
}

.branding {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
  transition: padding 0.2s ease;
}

.header-logo {
  height: 45px;
  width: auto;
  transition: height 0.2s ease;
}

.header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.byline {
  margin: -5px 0 0 0;
  font-size: 0.9rem;
  opacity: 0.8;
  font-weight: 500;
}
/* --- END NEW BRANDING STYLES --- */

header.scrolled {
  /* Avoid animating layout-changing properties */
  padding: 0.75rem 1rem 1rem 1rem; /* Slightly more bottom padding when compact */
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* MODIFIED FOR BRANDING */
header.scrolled h1 {
  font-size: 1.5rem;
}

/* --- NEW SCROLLED STYLES --- */
header.scrolled .byline {
  display: none; /* Hide byline on scroll */
}

header.scrolled .header-logo {
  height: 30px; /* Smaller logo on scroll */
}

header.scrolled .branding {
  padding: 0;
}
/* --- END NEW SCROLLED STYLES --- */

header.scrolled .subtitle {
  display: none;
}

header h1 {
  margin: 0; /* Removed bottom margin */
  font-size: 2rem;
  font-weight: bold;
  transition: font-size 0.2s ease;
}

header .subtitle {
  margin: 0.5rem 0 1rem 0; /* Adjusted margin */
  opacity: 0.9;
  font-size: 0.95rem;
}

.controls {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

button {
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

button:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Message Type Tabs */
.message-type-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  max-width: 1100px;
  margin: 2rem auto 0 auto;
  padding: 0 1rem;
  border-bottom: 2px solid #ddd;
}

.message-type-btn {
  background: transparent;
  color: #666;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border-radius: 0;
  white-space: nowrap;
}

/* All Messages button - centered in its own row */
.message-type-btn.all-messages-btn {
  grid-column: 2 / 5;
  justify-self: center;
  min-width: 200px;
}

.message-type-btn:hover {
  background: rgba(204,0,0,0.05);
  color: #cc0000;
  transform: none;
}

.message-type-btn.active {
  color: #cc0000;
  border-bottom-color: #cc0000;
  background: transparent;
}

/* Tab Counter Badge */
.tab-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 10px;
  line-height: 1;
}

.message-type-btn:not(.active) .tab-counter {
  background: #999;
}

.message-type-btn:hover:not(.active) .tab-counter {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
}

/* Filters Section */
.filters-section {
  max-width: 900px;
  margin: 1rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-container {
  position: relative;
  flex: 1;
  min-width: 0;
}

#searchInput {
  width: 100%;
  padding: 0.8rem 2.5rem 0.8rem 1rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

#searchInput:focus {
  outline: none;
  border-color: #cc0000;
}

.clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: #666;
  padding: 0.5rem;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover {
  background: rgba(204,0,0,0.1);
  color: #cc0000;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quick-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #ddd;
  background: white;
  color: #555;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.quick-filter-btn:hover {
  border-color: #cc0000;
  color: #cc0000;
  background: rgba(204, 0, 0, 0.05);
}

.quick-filter-btn.active {
  background: #cc0000;
  border-color: #cc0000;
  color: white;
}

#dateRange {
  padding: 0.6rem 1rem;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  background: white;
  transition: border-color 0.3s ease;
  min-width: 150px;
}

#dateRange:focus {
  outline: none;
  border-color: #cc0000;
}

/* Results */
.results {
  max-width: 900px;
  margin: 0 auto 2rem auto;
  display: grid;
  gap: 1.25rem;
  padding: 0 1rem;
}

.maradmin {
  background: #fff;
  padding: 1.5rem;
  border-left: 5px solid #cc0000;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.maradmin:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.maradmin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.maradmin-id {
  font-family: 'Courier New', monospace;
  color: #cc0000;
  font-weight: bold;
  font-size: 1.1rem;
}

.maradmin-date {
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
}

.maradmin h2 {
  margin: 0;
  font-size: 1.1rem;
}

.maradmin-subject {
  margin: 0 0 0.75rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
}

.maradmin-subject a {
  color: #222;
  text-decoration: none;
  transition: color 0.3s ease;
}

.maradmin-subject a:hover {
  color: #cc0000;
}

.maradmin-summary {
  color: #555;
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.maradmin-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
}

.category {
  background: #f0f0f0;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  color: #666;
  font-size: 0.85rem;
}

.view-full {
  color: #cc0000;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.view-full:hover {
  text-decoration: underline;
}

.expand-btn,

.expand-btn:hover {
  background: #990000;
}

.expand-btn:disabled,

/* Enhanced 5W Summary Styling */
.summary-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1565c0;
  text-align: center;
  padding: 0.75rem;
  margin: -0.5rem -0.5rem 1rem -0.5rem;
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(21, 101, 192, 0.3);
}

.summary-divider {
  border: none;
  border-top: 2px solid #1565c0;
  margin: 1rem 0;
  opacity: 0.3;
}

.five-w-header {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1565c0;
  margin: 1rem 0 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: rgba(21, 101, 192, 0.08);
  border-left: 3px solid #1565c0;
  border-radius: 0 4px 4px 0;
}

/* 5W table */
.fivew-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1rem;
}
.fivew-table thead th {
  background: rgba(21, 101, 192, 0.08);
  color: #1565c0;
  font-weight: 700;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid #e0e0e0;
}
.fivew-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.fivew-table tr:last-child td {
  border-bottom: none;
}

/* Key points sections */
.section-subheader {
  font-size: 1rem;
  font-weight: 700;
  color: #1565c0;
  margin: 0.75rem 0 0.25rem 0;
}
.key-points-list {
  margin: 0.25rem 0 0.75rem 1rem;
}
.key-points-list li {
  margin: 0.25rem 0;
  line-height: 1.6;
}

.w-item {
  display: flex;
  margin: 0.5rem 0;
  padding: 0.6rem 0.75rem;
  background: white;
  border-radius: 4px;
  border-left: 3px solid #1565c0;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.w-label {
  font-weight: 700;
  color: #1565c0;
  min-width: 70px;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.w-content {
  color: #333;
  line-height: 1.5;
}

/* Individual W item colors */
.who-item { border-left-color: #1976d2; }
.who-item .w-label { color: #1976d2; }

.what-item { border-left-color: #388e3c; }
.what-item .w-label { color: #388e3c; }

.when-item { border-left-color: #f57c00; }
.when-item .w-label { color: #f57c00; }

.where-item { border-left-color: #7b1fa2; }
.where-item .w-label { color: #7b1fa2; }

.why-item { border-left-color: #c62828; }
.why-item .w-label { color: #c62828; }

.key-points-header {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f57c00;
  margin: 1.25rem 0 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: rgba(245, 124, 0, 0.08);
  border-left: 3px solid #f57c00;
  border-radius: 0 4px 4px 0;
}

.section-header {
  font-size: 1rem;
  font-weight: 700;
  color: #1565c0;
  margin: 1rem 0 0.5rem 0;
  padding: 0.4rem 0.6rem;
  background: rgba(21, 101, 192, 0.05);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.bullet-item {
  margin: 0.4rem 0 0.4rem 1rem;
  padding-left: 0.5rem;
  color: #333;
  line-height: 1.6;
}

.maradmin-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid #eee;
}

.five-ws {
  background: #f9f9f9;
  padding: 1rem;
  border-radius: 6px;
}

.five-ws h4 {
  margin: 0 0 1rem 0;
  color: #cc0000;
  font-size: 1.1rem;
}

.ws-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.w-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.w-item strong {
  color: #cc0000;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.w-item span {
  color: #444;
  line-height: 1.5;
}

.maradmin-number-found {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
  color: #cc0000;
  font-size: 1rem;
}

.loading-details,
.error-details {
  padding: 1rem;
  text-align: center;
  color: #666;
  font-style: italic;
}

.error-details {
  color: #cc0000;
}

.mcpub-details {
  background: #f9f9f9;
  padding: 1rem;
  border-radius: 6px;
}

.mcpub-details h4 {
  margin: 0 0 1rem 0;
  color: #cc0000;
  font-size: 1.1rem;
}

.pdf-download {
  margin: 1rem 0;
  padding: 1rem;
  background: #fff;
  border: 2px dashed #cc0000;
  border-radius: 6px;
  text-align: center;
}

.download-pdf-btn {
  display: inline-block;
  background: #cc0000;
  color: white;
  padding: 0.75rem 2rem;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.3s ease;
}

.download-pdf-btn:hover {
  background: #990000;
}

.pdf-link-url {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: #666;
  font-family: 'Courier New', monospace;
}

.mcpub-info {
  margin: 0.75rem 0;
  padding: 0.5rem;
  background: #fff;
  border-radius: 4px;
}

.mcpub-info strong {
  color: #cc0000;
  margin-right: 0.5rem;
}

.no-pdf-found {
  text-align: center;
  color: #666;
  font-style: italic;
  margin: 1rem 0;
}

/* Status and Error */
.status, .error {
  text-align: center;
  padding: 0.75rem;
  margin: 1rem auto;
  max-width: 900px;
  border-radius: 6px;
}

.status {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 500;
}

.error {
  background: #ffe6e6;
  color: #cc0000;
  border-left: 4px solid #cc0000;
  font-weight: 500;
}

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
  font-size: 1.1rem;
}

.no-results p {
  margin: 0 0 0.5rem;
}

/* Diagnostic lines under a failed-load empty state. Smaller and muted so the
   primary message stays dominant. */
.no-results-detail {
  font-size: 0.9rem;
  opacity: 0.8;
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
}

.hidden {
  display: none;
}

/* NEW Badge */
.new-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  background: #333;
  color: #fff;
  margin-top: 3rem;
  font-size: 0.9rem;
}

footer p {
  margin: 0.5rem 0;
}

footer a {
  color: #ff6b6b;
  text-decoration: none;
  transition: color 0.3s ease;
}

footer a:hover {
  color: #ff8787;
  text-decoration: underline;
}

/* --- NEW FOOTER BRANDING --- */
.nexus-branding {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.nexus-branding a {
  color: #fff;
  text-decoration: none;
  /* Purple accent for branding */
  border-bottom: 2px solid #7b1fa2; 
  padding-bottom: 2px;
  transition: all 0.3s ease;
}

.nexus-branding a:hover {
  color: #eee;
  border-bottom-color: #ce93d8; /* Lighter purple */
}
/* --- END NEW FOOTER BRANDING --- */

.footer-note {
  color: #aaa;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.footer-legal {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #555;
  font-size: 0.85rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-legal-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.3s ease;
  font-size: 0.85rem;
  padding: 0;
  font-family: inherit;
}

.footer-legal-btn:hover {
  color: #ff8787;
  text-decoration: underline;
}

/* Legal Modal */
.legal-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.legal-modal.hidden {
  display: none;
}

.legal-modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.legal-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.legal-modal-header h2 {
  margin: 0;
  color: #222;
  font-size: 1.5rem;
}

.legal-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.3s ease, color 0.3s ease;
}

.legal-modal-close:hover {
  background: #f0f0f0;
  color: #222;
}

.legal-modal-body {
  overflow-y: auto;
  padding: 2rem;
  color: #444;
  line-height: 1.6;
  font-size: 0.95rem;
}

.legal-modal-body h1 {
  color: #cc0000;
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

.legal-modal-body h2 {
  color: #cc0000;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.legal-modal-body h3 {
  color: #666;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.legal-modal-body p {
  margin: 0.5rem 0;
}

.legal-modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.legal-modal-body table th,
.legal-modal-body table td {
  border: 1px solid #ddd;
  padding: 0.5rem;
  text-align: left;
}

.legal-modal-body table th {
  background: #f5f5f5;
  color: #222;
  font-weight: 600;
}

.legal-modal-body ul,
.legal-modal-body ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.legal-modal-body li {
  margin: 0.25rem 0;
}

.legal-modal-body a {
  color: #cc0000;
  text-decoration: none;
}

.legal-modal-body a:hover {
  text-decoration: underline;
}

.legal-modal-body strong {
  color: #222;
  font-weight: 600;
}

.legal-modal-body code {
  background: #f5f5f5;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.legal-modal-body hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1.5rem 0;
}

/* Summary Stats Panel */
.summary-stats {
  max-width: 900px;
  margin: 1rem auto;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
  border-left: 5px solid #cc0000;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.summary-stats h3 {
  margin: 0;
  color: #cc0000;
  font-size: 1.2rem;
  font-weight: 600;
}

.stats-toggle-btn {
  background: transparent;
  border: none;
  color: #cc0000;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: all 0.3s ease;
  border-radius: 4px;
}

.stats-toggle-btn:hover {
  background: rgba(204, 0, 0, 0.1);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.stats-grid.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: -1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
}

.stat-value {
  color: #222;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Compact View Table */
.compact-view {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Individual card styling */
.compact-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.compact-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

/* Subject header - prominently displayed at top */
.compact-card-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-bottom: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Details grid below subject */
.compact-card-details {
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 768px) {
  .compact-card-details {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Individual detail columns */
.compact-detail-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.compact-detail-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.025em;
}

.compact-detail-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.compact-id {
  font-family: 'Courier New', monospace;
  color: #cc0000;
  font-weight: 600;
  font-size: 0.9rem;
}

.compact-date {
  color: #666;
  font-size: 0.85rem;
}

.compact-subject {
  color: #1f2937;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  display: inline-block;
  line-height: 1.5;
  transition: color 0.3s ease;
  letter-spacing: 0.01em;
  flex: 1;
  min-width: 0;
}

.compact-subject:hover {
  color: #cc0000;
  text-decoration: underline;
}

.type-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.type-badge.type-maradmin {
  background: #e3f2fd;
  color: #1565c0;
}

.type-badge.type-mcpub {
  background: #e8f5e9;
  color: #2e7d32;
}

.type-badge.type-alnav {
  background: #fff3e0;
  color: #e65100;
}

.type-badge.type-almar {
  background: #fce4ec;
  color: #c2185b;
}

.type-badge.type-dodforms {
  background: #e8f5e9;
  color: #2e7d32;
}

.type-badge.type-secnav {
  background: #e1f5fe;
  color: #01579b;
}

.type-badge.type-jtr {
  background: #fff3e0;
  color: #e65100;
}

.type-badge.type-dodfmr {
  background: #e8eaf6;
  color: #3f51b5;
}

.compact-expand-btn {
  background: #cc0000;
  color: white;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.3s ease;
  white-space: nowrap;
}

.compact-expand-btn:hover {
  background: #990000;
}

/* No actions indicator for message types without buttons */
.no-actions {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
}

.compact-details-row {
  background: #f9f9f9;
  border-bottom: 1px solid #eee;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.compact-details-content {
  padding: 1rem 1.5rem;
}

.compact-summary {
  margin-bottom: 0.75rem;
  color: #555;
  line-height: 1.6;
}

.compact-category {
  margin-bottom: 0.75rem;
  color: #666;
}

.compact-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.compact-link-btn {
  color: #cc0000;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.compact-link-btn:hover {
  text-decoration: underline;
}

/* Skeleton Loader */
.skeleton-loader {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.skeleton-row {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.skeleton-item {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
  height: 20px;
}

.skeleton-id {
  width: 80%;
}

.skeleton-date {
  width: 90%;
}

.skeleton-subject {
  width: 95%;
}

.skeleton-keywords {
  width: 70%;
}

.skeleton-actions {
  width: 85%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Dark Theme */
body.dark-theme {
  background: #1a1a1a;
  color: #e0e0e0;
}

body.dark-theme .maradmin {
  background: #2a2a2a;
  border-left-color: #ff4444;
}

body.dark-theme .maradmin-subject a {
  color: #e0e0e0;
}

body.dark-theme .maradmin-subject a:hover {
  color: #ff4444;
}

body.dark-theme .maradmin-summary {
  color: #b0b0b0;
}

body.dark-theme .maradmin-footer {
  border-top-color: #444;
}

body.dark-theme .category {
  background: #3a3a3a;
  color: #b0b0b0;
}

body.dark-theme .view-full {
  color: #ff4444;
}

body.dark-theme #searchInput,
body.dark-theme #dateRange {
  background: #2a2a2a;
  color: #e0e0e0;
  border-color: #444;
}

body.dark-theme #searchInput:focus,
body.dark-theme #dateRange:focus {
  border-color: #ff4444;
}

body.dark-theme .filter-controls label {
  color: #b0b0b0;
}

body.dark-theme .status {
  background: #1a3a4a;
  color: #64b5f6;
}

body.dark-theme .error {
  background: #4a1a1a;
  color: #ff6666;
  border-left-color: #ff4444;
}

body.dark-theme footer {
  background: #0a0a0a;
}

body.dark-theme footer a {
  color: #ff4444;
}

/* --- NEW DARK MODE FOOTER --- */
body.dark-theme .nexus-branding a {
  color: #fff;
  border-bottom-color: #ce93d8; /* Lighter purple */
}

body.dark-theme .nexus-branding a:hover {
  border-bottom-color: #7b1fa2; /* Darker purple */
}
/* --- END NEW DARK MODE FOOTER --- */

body.dark-theme .expand-btn {
  background: #ff4444;
}

body.dark-theme .expand-btn:hover {
  background: #ff6666;
}

body.dark-theme .expand-btn:disabled {
  background: #555;
}

/* Dark mode for Enhanced 5W Summary */
body.dark-theme .summary-title {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(21, 101, 192, 0.4);
}

body.dark-theme .summary-divider {
  border-top-color: #1976d2;
  opacity: 0.4;
}

body.dark-theme .five-w-header {
  color: #64b5f6;
  background: rgba(100, 181, 246, 0.1);
  border-left-color: #64b5f6;
}

/* Dark mode for table and sections */
body.dark-theme .fivew-table {
  background: rgba(255,255,255,0.04);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
body.dark-theme .fivew-table thead th {
  background: rgba(100, 181, 246, 0.1);
  color: #64b5f6;
  border-bottom-color: rgba(255,255,255,0.15);
}
body.dark-theme .fivew-table td {
  border-bottom-color: rgba(255,255,255,0.08);
}
body.dark-theme .section-subheader {
  color: #64b5f6;
}

body.dark-theme .w-item {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

body.dark-theme .w-content {
  color: #e0e0e0;
}

body.dark-theme .who-item { border-left-color: #64b5f6; }
body.dark-theme .who-item .w-label { color: #64b5f6; }

body.dark-theme .what-item { border-left-color: #66bb6a; }
body.dark-theme .what-item .w-label { color: #66bb6a; }

body.dark-theme .when-item { border-left-color: #ffa726; }
body.dark-theme .when-item .w-label { color: #ffa726; }

body.dark-theme .where-item { border-left-color: #ba68c8; }
body.dark-theme .where-item .w-label { color: #ba68c8; }

body.dark-theme .why-item { border-left-color: #ef5350; }
body.dark-theme .why-item .w-label { color: #ef5350; }

body.dark-theme .key-points-header {
  color: #ffa726;
  background: rgba(255, 167, 38, 0.1);
  border-left-color: #ffa726;
}

body.dark-theme .section-header {
  color: #64b5f6;
  background: rgba(100, 181, 246, 0.08);
}

body.dark-theme .bullet-item {
  color: #e0e0e0;
}

body.dark-theme .maradmin-details {
  border-top-color: #444;
}

body.dark-theme .five-ws {
  background: #1a1a1a;
  border: 1px solid #444;
}

body.dark-theme .five-ws h4 {
  color: #ff4444;
}

body.dark-theme .w-item strong {
  color: #ff4444;
}

body.dark-theme .w-item span {
  color: #b0b0b0;
}

body.dark-theme .maradmin-number-found {
  border-top-color: #444;
  color: #ff4444;
}

body.dark-theme .loading-details {
  color: #888;
}

body.dark-theme .error-details {
  color: #ff6666;
}

body.dark-theme .message-type-tabs {
  border-bottom-color: #444;
}

body.dark-theme .message-type-btn {
  color: #888;
}

body.dark-theme .message-type-btn:hover {
  background: rgba(255,68,68,0.1);
  color: #ff4444;
}

body.dark-theme .message-type-btn.active {
  color: #ff4444;
  border-bottom-color: #ff4444;
}

body.dark-theme .tab-counter {
  background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
}

body.dark-theme .message-type-btn:not(.active) .tab-counter {
  background: #555;
}

body.dark-theme .message-type-btn:hover:not(.active) .tab-counter {
  background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
}

body.dark-theme .mcpub-details {
  background: #1a1a1a;
  border: 1px solid #444;
}

body.dark-theme .mcpub-details h4 {
  color: #ff4444;
}

body.dark-theme .pdf-download {
  background: #2a2a2a;
  border-color: #ff4444;
}

body.dark-theme .download-pdf-btn {
  background: #ff4444;
}

body.dark-theme .download-pdf-btn:hover {
  background: #ff6666;
}

body.dark-theme .pdf-link-url {
  color: #888;
}

body.dark-theme .mcpub-info {
  background: #2a2a2a;
}

body.dark-theme .mcpub-info strong {
  color: #ff4444;
}

body.dark-theme .no-pdf-found {
  color: #888;
}

body.dark-theme .summary-stats {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-left-color: #ff4444;
}

body.dark-theme .summary-stats h3 {
  color: #ff4444;
}

body.dark-theme .stats-toggle-btn {
  color: #ff4444;
}

body.dark-theme .stats-toggle-btn:hover {
  background: rgba(255, 68, 68, 0.1);
}

body.dark-theme .stat-label {
  color: #888;
}

body.dark-theme .stat-value {
  color: #e0e0e0;
}

body.dark-theme .compact-view {
  background: #2a2a2a;
}

body.dark-theme .compact-card {
  background: #2a2a2a;
  border-color: #444;
}

body.dark-theme .compact-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

body.dark-theme .compact-card-header {
  background: linear-gradient(135deg, #3a3a3a 0%, #2d2d2d 100%);
  border-bottom-color: #555;
}

body.dark-theme .compact-detail-label {
  color: #888;
}

body.dark-theme .compact-header {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
}

body.dark-theme .compact-row {
  border-bottom-color: #444;
}

body.dark-theme .compact-row:hover {
  background: #333;
}

body.dark-theme .compact-id {
  color: #ff4444;
}

body.dark-theme .compact-date {
  color: #888;
}

body.dark-theme .compact-subject {
  color: #e0e0e0;
}

body.dark-theme .compact-subject:hover {
  color: #ff4444;
}

body.dark-theme .type-badge.type-maradmin {
  background: #1a3a4a;
  color: #64b5f6;
}

body.dark-theme .type-badge.type-mcpub {
  background: #1a3a1a;
  color: #81c784;
}

body.dark-theme .type-badge.type-alnav {
  background: #3a2a1a;
  color: #ffb74d;
}

body.dark-theme .type-badge.type-almar {
  background: #3a1a2a;
  color: #f48fb1;
}

body.dark-theme .type-badge.type-dodforms {
  background: #1b3a1b;
  color: #81c784;
}

body.dark-theme .type-badge.type-secnav {
  background: #1a2a3a;
  color: #4fc3f7;
}

body.dark-theme .type-badge.type-jtr {
  background: #3a2a1a;
  color: #ffb74d;
}

body.dark-theme .type-badge.type-dodfmr {
  background: #1a1a3a;
  color: #9fa8da;
}

body.dark-theme .compact-expand-btn {
  background: #ff4444;
}

body.dark-theme .compact-expand-btn:hover {
  background: #ff6666;
}

body.dark-theme .no-actions {
  color: #666;
}

body.dark-theme .compact-details-row {
  background: #1a1a1a;
  border-bottom-color: #444;
}

body.dark-theme .compact-summary {
  color: #b0b0b0;
}

body.dark-theme .compact-category {
  color: #888;
}

body.dark-theme .compact-link-btn {
  color: #ff4444;
}

body.dark-theme .skeleton-row {
  border-bottom-color: #444;
}

body.dark-theme .skeleton-item {
  background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
  background-size: 200% 100%;
}

body.dark-theme .quick-filter-btn {
  background: #2a2a2a;
  border-color: #444;
  color: #b0b0b0;
}

body.dark-theme .quick-filter-btn:hover {
  border-color: #ff4444;
  color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
}

body.dark-theme .quick-filter-btn.active {
  background: #ff4444;
  border-color: #ff4444;
  color: white;
}

body.dark-theme .new-badge {
  background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
  box-shadow: 0 2px 4px rgba(255, 68, 68, 0.4);
}

body.dark-theme .footer-note {
  color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* MODIFIED FOR BRANDING */
  header h1 {
    font-size: 1.25rem;
  }
  .byline {
    font-size: 0.8rem;
    margin-top: -2px;
  }
  .header-logo {
    height: 35px;
  }
  /* END MODIFICATION */

  /* Mobile tab navigation - stack buttons vertically */
  .message-type-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.5rem auto 0 auto;
    padding: 0 0.5rem;
    border-bottom: none;
  }

  .message-type-btn {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    border-bottom: none !important;
  }

  .message-type-btn.active {
    background: rgba(204,0,0,0.1);
    border-color: #cc0000;
  }

  .message-type-btn.all-messages-btn {
    grid-column: auto;
    justify-self: auto;
    min-width: auto;
    margin-top: 0.5rem;
    background: rgba(204,0,0,0.05);
  }

  .tab-counter {
    min-width: 20px;
    height: 18px;
    font-size: 0.7rem;
    padding: 0 5px;
    margin-left: 4px;
  }

  /* Mobile quick filter buttons - 2 rows of 4 */
  .quick-filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    width: 100%;
  }

  .quick-filter-btn {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .maradmin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .maradmin-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Responsive compact view - stack columns on mobile */
  .compact-header {
    display: none; /* Hide header on mobile */
  }

  /* Card layout already responsive with grid-template-columns: repeat(2, 1fr) on mobile */
  .compact-card-details {
    padding: 0.875rem;
    gap: 0.875rem;
  }

  .compact-card-header {
    padding: 0.875rem;
  }

  .compact-subject {
    font-size: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Print Styles */
@media print {
  /* Reset colors for print */
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  /* Hide non-essential elements */
  header .controls,
  .message-type-tabs,
  .filters-section,
  .compact-expand-btn,
  .quick-filters,
  .summary-stats,
  footer,
  .stats-toggle-btn {
    display: none !important;
  }

  /* Simplify header */
  header {
    padding: 1rem;
    position: static;
    border-bottom: 2px solid #000;
  }
  /* Hide fixed spacer during print */
  #headerSpacer { display: none !important; }
  
  /* UPDATED PRINT HEADER */
  .branding {
    padding: 0 !important;
  }
  .header-logo {
    height: 30px !important;
  }
  .byline {
    display: block !important;
    font-size: 0.8rem !important;
    color: #555 !important;
    margin-top: 0 !important;
  }

  header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
  }
  /* END UPDATED PRINT HEADER */

  header .subtitle {
    font-size: 0.9rem;
    display: block !important;
  }

  /* Show status */
  #status {
    font-weight: bold;
    margin: 1rem 0;
    page-break-after: avoid;
  }

  /* Compact cards for print */
  .compact-card {
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #000 !important;
    margin-bottom: 0.5rem;
  }

  .compact-card-header {
    background: #f0f0f0 !important;
    border-bottom: 1px solid #000 !important;
  }

  .compact-detail-col--action {
    display: none !important; /* Hide action column in print */
  }

  /* Show links */
  .compact-subject {
    color: #000 !important;
    text-decoration: underline;
  }

  /* Type badges */
  .type-badge {
    border: 1px solid #000;
    padding: 0.15rem 0.4rem;
  }

  /* Hide expanded details */
  .compact-details-row {
    display: none !important;
  }

  /* Page breaks */
  .compact-view {
    page-break-before: avoid;
  }

  h3 {
    page-break-after: avoid;
  }

  /* Print specific title */
  header::after {
    content: "Printed: " attr(data-print-date);
    display: block;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
  }
}

/* ====================================
   FEEDBACK WIDGET STYLES
   ==================================== */

/* Floating Feedback Button */
.feedback-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
  color: white;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.3);
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedback-btn:hover {
  background: linear-gradient(135deg, #990000 0%, #770000 100%);
  box-shadow: 0 6px 16px rgba(204, 0, 0, 0.4);
  transform: translateY(-2px);
}

.feedback-btn:active {
  transform: translateY(0);
}

/* Feedback Modal */
.feedback-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.feedback-modal.hidden {
  display: none;
}

.feedback-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal Header */
.feedback-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 2px solid #f0f0f0;
}

.feedback-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #222;
}

.feedback-close-btn {
  background: transparent;
  border: none;
  color: #666;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.feedback-close-btn:hover {
  background: rgba(204, 0, 0, 0.1);
  color: #cc0000;
}

/* Form Styles */
#feedbackForm {
  padding: 1.5rem;
}

.feedback-form-group {
  margin-bottom: 1.25rem;
}

.feedback-form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

.required {
  color: #cc0000;
  font-weight: bold;
}

.feedback-form-group input,
.feedback-form-group select,
.feedback-form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.feedback-form-group input:focus,
.feedback-form-group select:focus,
.feedback-form-group textarea:focus {
  outline: none;
  border-color: #cc0000;
}

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

/* Form Actions */
.feedback-form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.feedback-btn-primary,
.feedback-btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.feedback-btn-primary {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
  color: white;
}

.feedback-btn-primary:hover {
  background: linear-gradient(135deg, #990000 0%, #770000 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.3);
}

.feedback-btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.feedback-btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.feedback-btn-secondary:hover {
  background: #e0e0e0;
}

/* Feedback Status Message */
.feedback-status {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.feedback-status.success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #2e7d32;
}

.feedback-status.error {
  background: #ffe6e6;
  color: #cc0000;
  border-left: 4px solid #cc0000;
}

.feedback-status.hidden {
  display: none;
}

/* Dark Theme for Feedback Widget */
body.dark-theme .feedback-modal-content {
  background: #2a2a2a;
}

body.dark-theme .feedback-modal-header {
  border-bottom-color: #444;
}

body.dark-theme .feedback-modal-header h2 {
  color: #e0e0e0;
}

body.dark-theme .feedback-close-btn {
  color: #888;
}

body.dark-theme .feedback-close-btn:hover {
  background: rgba(255, 68, 68, 0.1);
  color: #ff4444;
}

body.dark-theme .feedback-form-group label {
  color: #e0e0e0;
}

body.dark-theme .feedback-form-group small {
  color: #999 !important;
}

body.dark-theme .feedback-form-group input,
body.dark-theme .feedback-form-group select,
body.dark-theme .feedback-form-group textarea {
  background: #1a1a1a;
  color: #e0e0e0;
  border-color: #444;
}

body.dark-theme .feedback-form-group input:focus,
body.dark-theme .feedback-form-group select:focus,
body.dark-theme .feedback-form-group textarea:focus {
  border-color: #ff4444;
}

body.dark-theme .feedback-btn-secondary {
  background: #3a3a3a;
  color: #e0e0e0;
}

body.dark-theme .feedback-btn-secondary:hover {
  background: #444;
}

body.dark-theme .feedback-btn {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
}

body.dark-theme .feedback-btn:hover {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
}

body.dark-theme .feedback-btn-primary {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
}

body.dark-theme .feedback-btn-primary:hover {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
}

body.dark-theme .feedback-status.success {
  background: #1a3a1a;
  color: #81c784;
  border-left-color: #66bb6a;
}

body.dark-theme .feedback-status.error {
  background: #4a1a1a;
  color: #ff6666;
  border-left-color: #ff4444;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .feedback-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .feedback-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .feedback-modal-header {
    padding: 1rem;
  }

  .feedback-modal-header h2 {
    font-size: 1.25rem;
  }

  #feedbackForm {
    padding: 1rem;
  }

  .feedback-form-actions {
    flex-direction: column;
  }

  .feedback-btn-primary,
  .feedback-btn-secondary {
    width: 100%;
  }
}

/* Email privacy note styling */
#emailPrivacyNote {
  display: block;
  margin-top: 0.25rem;
  color: #666;
  font-size: 0.85rem;
}

/* Help Modal - Keyboard Shortcuts */
.help-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.help-shortcut {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.help-shortcut kbd {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--border-color);
  min-width: 2rem;
  text-align: center;
}

.help-shortcut span {
  flex: 1;
  color: var(--text-color);
}

/* Dark mode kbd styling */
body.dark-theme .help-shortcut kbd {
  background: #2a2a2a;
  border-color: #444;
  box-shadow: 0 2px 0 #444;
}

/* Hide feedback button and modals when printing */
@media print {
  .feedback-btn,
  .feedback-modal {
    display: none !important;
  }
}

/* ============================================================================
   SEMPER NEXUS STYLE GUIDE OVERRIDES
   Tokens sourced from semper-tokens.css. This block restyles every major
   surface to the Semper Admin Portal v1.2 visual system. Loaded after the
   legacy rules above so token-driven declarations win the cascade.
   ============================================================================ */

html, body {
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
}

body.dark-theme {
  background: var(--color-background);
  color: var(--color-foreground);
}

::selection {
  background: var(--color-brass);
  color: var(--color-neutral-950);
}

/* ---------- Header floating pill chrome ---------- */
header {
  background: linear-gradient(135deg,
    var(--color-marine-blue-700) 0%,
    var(--color-marine-blue) 100%);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: var(--space-6) var(--space-4) var(--space-7) var(--space-4);
  color: var(--color-parchment);
}

body.dark-theme header {
  background: color-mix(in srgb, var(--color-bg-elev) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
}

header h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-5xl);
  letter-spacing: 0.01em;
  line-height: 1;
  margin: 0;
}

header.scrolled h1 {
  font-size: var(--text-3xl);
}

.byline {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-parchment-700);
  margin: var(--space-1) 0 0 0;
  opacity: 0.92;
}

header .subtitle {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-parchment-300);
  opacity: 0.85;
  margin: var(--space-3) 0 var(--space-4) 0;
}

.branding {
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
}

.header-logo {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* ---------- Buttons ---------- */
.controls {
  margin-top: var(--space-4);
  gap: var(--space-3);
}

button {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--color-parchment) 18%, transparent);
  color: var(--color-parchment);
  border: 1px solid color-mix(in srgb, var(--color-parchment) 24%, transparent);
  transition: background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
}

button:hover {
  background: color-mix(in srgb, var(--color-usmc-scarlet) 30%, transparent);
  border-color: var(--color-usmc-scarlet-300);
  transform: translateY(-1px);
}

button:active {
  background: var(--color-usmc-scarlet-700);
  transform: translateY(0);
}

#refreshBtn {
  background: var(--color-usmc-scarlet);
  border-color: var(--color-usmc-scarlet-700);
  color: var(--color-primary-foreground);
}

#refreshBtn:hover {
  background: var(--color-usmc-scarlet-300);
}

/* ---------- Main content + ambient bloom ---------- */
main {
  padding: var(--space-7) var(--space-4) var(--space-9);
  position: relative;
  isolation: isolate;
}

body.dark-theme main::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  max-width: 720px;
  height: 320px;
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--color-usmc-scarlet) 10%, transparent) 0%,
    color-mix(in srgb, var(--color-marine-blue-300) 8%, transparent) 40%,
    transparent 75%);
  pointer-events: none;
  z-index: -1;
  filter: blur(20px);
}

/* ---------- Message type tabs ---------- */
.message-type-tabs {
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-1);
  padding: 0 var(--space-4);
  margin-top: var(--space-7);
}

.message-type-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
}

.message-type-btn:hover {
  color: var(--color-foreground);
  background: var(--color-surface-2);
  border-bottom-color: var(--color-border-strong);
  transform: none;
}

.message-type-btn.active {
  color: var(--color-usmc-scarlet);
  border-bottom-color: var(--color-usmc-scarlet);
  background: color-mix(in srgb, var(--color-usmc-scarlet) 6%, transparent);
}

body.dark-theme .message-type-btn.active {
  color: var(--color-usmc-scarlet-300);
  border-bottom-color: var(--color-usmc-scarlet-300);
}

/* ---------- Tab counter as stat tile chip ---------- */
.tab-counter {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-base);
  background: var(--color-brass);
  color: var(--color-neutral-950);
  border: 1px solid var(--color-brass-700);
  border-radius: var(--radius-chip);
  min-width: 26px;
  padding: 1px var(--space-2);
}

.message-type-btn.active .tab-counter {
  background: var(--color-usmc-scarlet);
  border-color: var(--color-usmc-scarlet-700);
  color: var(--color-primary-foreground);
}

.message-type-btn:not(.active) .tab-counter {
  background: var(--color-surface-3);
  color: var(--color-foreground);
  border-color: var(--color-border);
}

/* ---------- Filters section ---------- */
.filters-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-6) auto;
  box-shadow: var(--shadow-sm);
}

#searchInput {
  font-family: var(--font-body);
  font-size: var(--text-md);
  background: var(--color-bg-elev);
  color: var(--color-foreground);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}

#searchInput:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  border-color: var(--color-usmc-scarlet);
}

.quick-filter-btn {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-2);
  color: var(--color-muted-foreground);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-chip);
}

.quick-filter-btn:hover {
  background: var(--color-surface-3);
  color: var(--color-foreground);
  border-color: var(--color-border-strong);
}

.quick-filter-btn.active {
  background: var(--color-usmc-scarlet);
  color: var(--color-primary-foreground);
  border-color: var(--color-usmc-scarlet-700);
}

/* ---------- Compact card surfaces ---------- */
.compact-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-brass);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
}

.compact-card:hover {
  box-shadow: var(--shadow-card-strong);
  transform: translateY(-2px);
  border-left-color: var(--color-usmc-scarlet);
}

.compact-card-header h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--color-foreground);
  line-height: 1.3;
}

.compact-card-details {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-subtle-foreground);
}

/* ---------- Type badges ---------- */
.type-badge {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-xs);
}

.type-badge.type-maradmin { background: var(--color-usmc-scarlet); color: var(--color-primary-foreground); }
.type-badge.type-mcpub    { background: var(--color-marine-blue);  color: var(--color-parchment); }
.type-badge.type-alnav    { background: var(--color-brass);        color: var(--color-neutral-950); }
.type-badge.type-almar    { background: var(--color-usmc-scarlet-300); color: var(--color-neutral-950); }
.type-badge.type-dodforms { background: var(--color-role-admin);   color: var(--color-primary-foreground); }
.type-badge.type-secnav   { background: var(--color-status-info);  color: var(--color-primary-foreground); }
.type-badge.type-jtr      { background: var(--color-brass-300);    color: var(--color-neutral-950); }
.type-badge.type-dodfmr   { background: var(--color-marine-blue-300); color: var(--color-parchment); }
.type-badge.type-igmc     { background: var(--color-brass-700);    color: var(--color-parchment); }

/* ---------- Status, error, summary stats ---------- */
.status {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  padding: var(--space-3) 0;
}

.error {
  background: color-mix(in srgb, var(--color-destructive) 12%, transparent);
  color: var(--color-destructive);
  border: 1px solid var(--color-destructive);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
}

.summary-stats {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.stat-item .stat-label {
  font: 700 11px/1 var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted-foreground);
}

.stat-item .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  color: var(--color-foreground);
  line-height: 1;
}

/* ---------- Footer ---------- */
footer {
  background: var(--color-bg-sunken);
  color: var(--color-muted-foreground);
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

footer p {
  margin: var(--space-1) 0;
}

.nexus-branding {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: 0.04em;
  color: var(--color-brass);
}

/* ---------- Skip link to brand ---------- */
.skip-link {
  background: var(--color-usmc-scarlet);
  color: var(--color-primary-foreground);
  font-family: var(--font-body);
  border-radius: 0 0 var(--radius-sm) 0;
}

/* ---------- Feedback widget ---------- */
.feedback-btn {
  background: var(--color-usmc-scarlet);
  color: var(--color-primary-foreground);
  border: 1px solid var(--color-usmc-scarlet-700);
  border-radius: var(--radius-chip);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-5);
  box-shadow: var(--shadow-md);
}

.feedback-btn:hover {
  background: var(--color-usmc-scarlet-300);
}

.feedback-modal-content {
  background: var(--color-card);
  color: var(--color-foreground);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.feedback-anonymous-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  background: color-mix(in srgb, var(--color-status-info) 8%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
}

/* ============================================================================
   Coming-soon inactive directive tabs (PAA, PAAN, TAN, FAN, ICAN)
   ============================================================================ */
.message-type-btn--inactive {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--color-surface-2);
  color: var(--color-subtle-foreground);
  border: 1px dashed var(--color-border);
}

.message-type-btn--inactive:hover {
  background: var(--color-surface-2);
  color: var(--color-subtle-foreground);
  border-color: var(--color-border);
  transform: none;
}

/* ============================================================================
   External link tabs (PAA - CAC-protected SharePoint list)
   Styled as an active, clickable tab with an external indicator.
   ============================================================================ */
.message-type-btn--external {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  text-decoration: none;
  border: 1px dashed var(--color-marine-blue-400, var(--color-border));
}

.message-type-btn--external:hover,
.message-type-btn--external:focus-visible {
  background: var(--color-marine-blue-100, var(--color-surface-2));
  color: var(--color-marine-blue-700, var(--color-foreground));
  border-style: solid;
}

.message-type-btn--external .external-icon {
  font-size: 0.85em;
  opacity: 0.8;
}

/* NAVMC Form type badge */
.type-badge.type-navmc {
  background: var(--color-marine-blue-100);
  color: var(--color-marine-blue-700);
}

/* ============================================================================
   Self-hosted icon set styling (replaces Font Awesome per Phase 1.3a)
   ============================================================================ */
.icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  color: currentColor;
  vertical-align: -0.125em;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon--spin svg {
  animation: nexus-icon-spin 1s linear infinite;
}

@keyframes nexus-icon-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .icon--spin svg { animation: none; }
}

/* ============================================================================
   PHASE 6 ACCESSIBILITY - WCAG 2.1 AA (36 CFR Part 1194)
   ============================================================================ */

/* 6.1 Contrast overrides for token combinations that failed AA audit
   ------------------------------------------------------------------------ */
:root {
  /* Subtle foreground: bump from #8A7E63 (3.64:1) to #6F634A (5.36:1) on parchment */
  --color-subtle-foreground: #6F634A;
  /* Accent (brass) on light bg used as UI control: bump from #B89042 (2.69:1) to brass-700 #8E6E2E (4.32:1) */
  --color-accent: #8E6E2E;
  /* Status info: bump from #2F5FA8 to #4A78C2 (4.18:1 on dark navy) */
  --color-status-info: #4A78C2;
}

.dark, body.dark-theme {
  /* Primary foreground (text on scarlet button) in dark mode: pure white passes 4.58:1 */
  --color-primary-foreground: #FFFFFF;
  /* Subtle foreground in dark restored to ink-200 brightness */
  --color-subtle-foreground: #B5A988;
}

/* Active tab dark mode: switch from scarlet-300 (4.03:1, FAIL) to brass-300 (8.90:1, PASS).
   The active state is still visually distinct from inactive and uses brand brass. */
body.dark-theme .message-type-btn.active {
  color: var(--color-brass-300);
  border-bottom-color: var(--color-brass-300);
}

/* 6.2 Universal focus-visible indicators
   ------------------------------------------------------------------------ */
*:focus {
  outline: none; /* suppress default to defer to focus-visible */
}

*:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="tab"]:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--color-ring) 25%, transparent);
}

.skip-link:focus,
.skip-link:focus-visible {
  outline: 3px solid var(--color-parchment);
  outline-offset: 2px;
}

/* 6.5 Tab reflow - use flex with wrap so the 16 buttons spread naturally.
   The original grid (5 cols) was set up for the smaller earlier tab set.
   ------------------------------------------------------------------------ */
.message-type-tabs {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1);
  grid-template-columns: none !important;
  max-width: 1200px;
  margin: 2rem auto 0 auto;
  padding: 0 1rem;
  overflow: visible;
}

.message-type-btn {
  flex: 0 0 auto;
}

/* Below 720px, hide inactive placeholder tabs and enable horizontal scroll
   so the 11 remaining tabs do not break layout */
@media (max-width: 720px) {
  .message-type-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: var(--space-2);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
  }
  .message-type-tabs::-webkit-scrollbar {
    height: 6px;
  }
  .message-type-tabs::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 3px;
  }
  .message-type-btn {
    scroll-snap-align: start;
  }
  .message-type-btn--inactive {
    display: none;
  }
}

@media (max-width: 320px) {
  .message-type-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}

/* 6.9 Redundant active-tab indicator beyond color
   ------------------------------------------------------------------------ */
.message-type-btn.active {
  font-weight: 800; /* color + weight + thicker border = three signals */
  border-bottom-width: 3px;
}

.message-type-btn.active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: var(--space-2);
  vertical-align: middle;
}

/* 6.10 Feedback form error states
   ------------------------------------------------------------------------ */
.feedback-form-group [aria-invalid="true"] {
  border-color: var(--color-destructive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-destructive) 25%, transparent);
}

/* Header feedback link — anchor styled to match .controls buttons */
.control-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--color-parchment) 18%, transparent);
  color: var(--color-parchment);
  border: 1px solid color-mix(in srgb, var(--color-parchment) 24%, transparent);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
}

.control-link:hover {
  background: color-mix(in srgb, var(--color-usmc-scarlet) 30%, transparent);
  border-color: var(--color-usmc-scarlet-300);
  transform: translateY(-1px);
  color: var(--color-parchment);
}

.control-link:active {
  transform: translateY(0);
}
