body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: #eef2f7;
  color: #1a202c;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  background: linear-gradient(135deg, #1f2933, #27364a);
  color: #fff;
  padding: 1.6rem 2.8rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.brand-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(124, 252, 0, 0.75);
  box-shadow: 0 0 18px rgba(0, 255, 128, 0.45);
}

.site-header h1,
.brand-title {
  margin: 0;
  font-size: 1.85rem;
  letter-spacing: 0.12em;
  font-family: "Share Tech Mono", "Courier New", monospace;
  color: #8dff9a;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(141, 255, 154, 0.65);
}

.site-header a {
  color: inherit;
  text-decoration: none;
}

main {
  padding: 2.8rem 2rem 3.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.controls {
  background: #fff;
  padding: 1.2rem 1.5rem;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  margin-bottom: 1.4rem;
}

.search-form {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-form input,
.search-form select,
.search-form button {
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid #cbd5e0;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-form input:focus,
.search-form select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.search-form button {
  background: #1f2933;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.search-form button:hover {
  background: #111827;
}

.priority-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: #374151;
}

.priority-actions {
  margin-top: 1.2rem;
  display: flex;
}

.priority-actions form {
  margin: 0;
}

.priority-btn {
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #38a169, #2f855a);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.priority-btn:hover {
  background: linear-gradient(135deg, #2f855a, #276749);
}

.priority-btn.danger {
  background: linear-gradient(135deg, #f56565, #e53e3e);
}

.priority-btn.danger:hover {
  background: linear-gradient(135deg, #e53e3e, #c53030);
}

.summary {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  color: #4a5568;
}

.table-wrapper {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

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

.org-table th,
.org-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.org-table th {
  background: #f1f5f9;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: #475569;
}

.org-table tbody tr:hover {
  background: #f8fafc;
}

.empty {
  text-align: center;
  color: #718096;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #e2e8f0;
  color: #1a202c;
}

.badge-priority {
  background: #38a169;
  color: #fff;
}

.priority-cell {
  min-width: 4.5rem;
}

.pagination {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.6rem;
}

.pagination a {
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  background: #e2e8f0;
  color: #1a202c;
  text-decoration: none;
  font-weight: 600;
}

.pagination a.active {
  background: #1f2933;
  color: #fff;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.2rem;
  text-decoration: none;
  color: #1f2933;
  font-weight: 600;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.flash.success {
  background: #f6ffed;
  border-color: #38a169;
  color: #22543d;
}

.flash.error {
  background: #fff5f5;
  border-color: #f56565;
  color: #742a2a;
}

.card {
  background: #fff;
  padding: 1.4rem;
  margin-bottom: 1.6rem;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.9rem;
  font-size: 1.05rem;
}

.loader-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.loader-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.loader-entry h4 {
  margin: 0;
  font-size: 1rem;
}

.loader-entry p {
  margin: 0.3rem 0 0;
  color: #4b5563;
  font-size: 0.9rem;
}

.loader-link {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: #1f2933;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.loader-link:hover {
  background: #111827;
}

.loader-card h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.loader-description {
  color: #4b5563;
  margin: 0;
}

.loader-action {
  margin-top: 1rem;
}

.loader-action button {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.loader-action button:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.loader-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.loader-status.success {
  border: 1px solid #38a169;
  background: #f6ffed;
  color: #22543d;
}

.loader-status.error {
  border: 1px solid #f56565;
  background: #fff5f5;
  color: #742a2a;
}

.loader-status.noop {
  border: 1px solid #cbd5e0;
  background: #f7fafc;
  color: #2d3748;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.metric-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metric-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: #f8fafc;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.metric-list span {
  color: #4b5563;
}

.metric-list strong {
  font-size: 0.95rem;
}

.meta-note {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #4a5568;
}

.card table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.4rem;
}

.card table th,
.card table td {
  padding: 0.7rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 0.92rem;
}

.card table th {
  background: #f8fafc;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: #4b5563;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 0.8rem;
}

.meta-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.97rem;
}

.meta-grid strong {
  color: #4a5568;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.aliases ul,
.evidence-list {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0 0;
}

.aliases li,
.evidence-list li {
  margin-bottom: 0.5rem;
}

.tag {
  background: #e53e3e;
  color: #fff;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-left: 0.35rem;
}

pre {
  background: #f8fafc;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  max-height: 160px;
  overflow: auto;
}

.evidence-list .meta {
  display: block;
  color: #718096;
  font-size: 0.82rem;
}

/* Dashboard Styles */
.dashboard {
  max-width: 1400px;
}

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

.dashboard-header h2 {
  margin: 0;
  font-size: 2rem;
  color: #1a202c;
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  background: #1f2933;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease;
}

.btn:hover {
  background: #111827;
  text-decoration: none;
}

.btn-secondary {
  background: #667eea;
}

.btn-secondary:hover {
  background: #5568d3;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.stat-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 2.2rem;
  color: #2563eb;
  font-weight: 700;
}

.stat-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section {
  background: #fff;
  padding: 1.8rem;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  margin-bottom: 2rem;
}

.section h3 {
  margin: 0 0 1.2rem 0;
  font-size: 1.3rem;
  color: #1a202c;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.8rem;
}

.top-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
}

.top-list table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
}

.top-list th,
.top-list td {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 0.92rem;
}

.top-list th {
  background: #f8fafc;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
}

.top-list th.num,
.top-list td.num {
  text-align: right;
}

.top-list tbody tr:hover {
  background: #f8fafc;
}

.top-list a {
  color: #2563eb;
  font-weight: 500;
}

.view-toggle {
  margin-bottom: 1rem;
}

/* Filter Stats (expandable org breakdown) */
.filter-stats {
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.filter-stats summary {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  color: #1f2933;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-stats summary::-webkit-details-marker {
  display: none;
}

.filter-stats summary::before {
  content: '▶';
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

.filter-stats[open] summary::before {
  transform: rotate(90deg);
}

.filter-stats summary:hover {
  background: #f1f5f9;
  border-radius: 8px 8px 0 0;
}

.stats-breakdown {
  padding: 1rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  border-top: 1px solid #e2e8f0;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

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

.stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2933;
}

/* Bulk Actions */
.bulk-actions {
  background: #fff;
  padding: 1rem 1.5rem;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  margin-bottom: 1rem;
}

.bulk-actions form {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.bulk-actions .btn {
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}

.bulk-actions .btn-primary {
  background: linear-gradient(135deg, #38a169, #2f855a);
  color: #fff;
}

.bulk-actions .btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2f855a, #276749);
}

.bulk-actions .btn-secondary {
  background: #e2e8f0;
  color: #1a202c;
}

.bulk-actions .btn-secondary:hover:not(:disabled) {
  background: #cbd5e0;
}

.bulk-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.selection-info {
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 500;
}

/* Checkbox Column */
.checkbox-col {
  width: 50px;
  text-align: center;
  padding: 0.85rem 0.5rem !important;
}

.checkbox-col input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

.org-checkbox {
  cursor: pointer;
}

/* Sortable Table Headers */
.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem !important;
}

.sortable-header:hover {
  background: #e2e8f0 !important;
}

.sortable-header::after {
  content: '⇅';
  position: absolute;
  right: 0.5rem;
  opacity: 0.3;
  font-size: 0.9rem;
}

.sortable-header.sort-asc::after {
  content: '▲';
  opacity: 1;
  color: #2563eb;
}

.sortable-header.sort-desc::after {
  content: '▼';
  opacity: 1;
  color: #2563eb;
}

.no-sort {
  cursor: default !important;
  padding-right: 1rem !important;
}

.no-sort::after {
  content: none !important;
}
