:root {
  --navy: #1f3864;
  --navy-light: #2c4f91;
  --primary: #2563eb;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --fresh: #166534;
  --fresh-bg: #dcfce7;
  --stale: #92400e;
  --stale-bg: #fef3c7;
  --no-act: #991b1b;
  --no-act-bg: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-header {
  background: var(--navy);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.app-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.app-header .subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-left: auto;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.card-body { padding: 20px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-700);
  font-size: 13px;
}
.form-group label .required { color: #dc2626; margin-left: 2px; }
.form-group small {
  display: block;
  color: var(--gray-500);
  font-size: 12px;
  margin-top: 4px;
}

input[type="text"],
input[type="file"],
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}
input[type="text"]:focus,
input[type="file"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input[type="file"] {
  padding: 6px 10px;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-light); color: white; text-decoration: none; }
.btn-accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-accent:hover { background: #1d4ed8; color: white; text-decoration: none; }
.btn-success {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
}
.btn-success:hover { background: #15803d; color: white; text-decoration: none; }
.btn-outline {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.btn-danger {
  background: white;
  color: #dc2626;
  border-color: #fca5a5;
}
.btn-danger:hover { background: #fef2f2; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Multi-file upload slots */
.file-slots { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; transition: background 0.1s, outline 0.1s; border-radius: 6px; }
.file-slots.drag-active { background: #eff6ff; outline: 2px dashed #2563eb; outline-offset: 3px; }
.file-slot { display: flex; align-items: center; gap: 6px; }
.file-slot input[type="file"] { flex: 1; font-size: 13px; }
.slot-remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid #fca5a5;
  color: #dc2626;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  padding: 3px 7px;
  cursor: pointer;
}
.slot-remove:hover { background: #fef2f2; }
.add-file-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.add-file-btn:hover { color: #1e40af; }

/* Alerts / Flash */
.alerts { margin-bottom: 16px; }
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-info { background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-fresh { background: var(--fresh-bg); color: var(--fresh); }
.badge-stale { background: var(--stale-bg); color: var(--stale); }
.badge-cold  { background: #FFEDD5; color: #7C2D12; }
.badge-no-activity { background: var(--no-act-bg); color: var(--no-act); }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.stat-card {
  flex: 1;
  min-width: 140px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.stat-card.fresh .stat-value { color: var(--fresh); }
.stat-card.stale .stat-value { color: var(--stale); }
.stat-card.no-act .stat-value { color: var(--no-act); }

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: var(--navy);
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr.row-fresh { background: #f0fdf4; }
tr.row-stale { background: #fffbeb; }
tr.row-no-activity { background: #fff7f7; }
tr.row-boom-only { background: #f5f3ff; }
tr.row-act-only  { background: #dcfce7; }
tr:hover td { background: rgba(37,99,235,0.04); }

/* Search */
.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
}
.filter-count {
  font-size: 12px;
  color: var(--gray-500);
  margin-left: auto;
  white-space: nowrap;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
}

/* Priority summary bar */
.priority-summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--gray-700);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: filter .12s, box-shadow .12s, border-color .12s;
  user-select: none;
}
.summary-pill:hover { filter: brightness(.92); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.summary-pill-danger  { background: #fee2e2; color: #991b1b; }
.summary-pill-cold    { background: #ffedd5; color: #7c2d12; }
.summary-pill-warning { background: #fef3c7; color: #92400e; }
.summary-pill-success { background: #dcfce7; color: #166534; }
.summary-pill-danger.pill-active  { border-color: #991b1b; box-shadow: 0 0 0 2px #fca5a5; }
.summary-pill-cold.pill-active    { border-color: #7c2d12; box-shadow: 0 0 0 2px #fdba74; }
.summary-pill-warning.pill-active { border-color: #92400e; box-shadow: 0 0 0 2px #fde68a; }
.summary-pill-success.pill-active { border-color: #166534; box-shadow: 0 0 0 2px #86efac; }

/* Numeric filter inputs and labels */
.filter-label { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.filter-num   { width: 90px; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; color: var(--gray-700); }
.filter-num:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,.15); }
.filter-count { font-size: 12px; color: var(--gray-500); margin-left: auto; white-space: nowrap; }

/* Sortable column headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #1a2a5e; }
th.sort-asc::after  { content: " \25B2"; font-size: 9px; color: var(--primary); }
th.sort-desc::after { content: " \25BC"; font-size: 9px; color: var(--primary); }

/* Stronger row colors in the priority table */
#priority-table tr.row-no-activity { background: #fde8e8; }
#priority-table tr.row-stale       { background: #fef0c3; }
#priority-table tr.row-no-activity:hover td,
#priority-table tr.row-stale:hover td { background: rgba(37,99,235,0.05); }

/* Truncate long notes with custom hover tooltip */
.col-note {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}
#note-tooltip {
  display: none;
  position: fixed;
  z-index: 99999;
  background: #1e293b;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 360px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  pointer-events: none;
}

/* Diagnostics */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.diag-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
}
.diag-item .diag-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; }
.diag-item .diag-value { font-size: 20px; font-weight: 700; color: var(--navy); margin-top: 2px; }

.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { padding: 4px 0; border-bottom: 1px solid var(--gray-100); font-size: 12px; }
.file-list li:last-child { border-bottom: none; }

/* Review section */
.review-item {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.review-item .review-name { font-weight: 700; font-size: 14px; color: var(--gray-900); }
.review-item .review-source { font-size: 11px; color: var(--gray-500); text-transform: uppercase; margin-bottom: 10px; }
.review-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.review-form select { flex: 1; min-width: 200px; max-width: 300px; }

/* Alias list */
.alias-table td:first-child { font-weight: 600; }
.alias-table td { color: var(--gray-700); }

/* Upload zone hint */
.upload-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  gap: 0;
}
.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.tab:hover { color: var(--navy); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section divider */
.section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  padding: 6px 12px;
  background: var(--gray-100);
  border-radius: 4px;
  margin: 8px 0 4px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { margin: 0; font-size: 14px; }

/* Action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.action-bar .run-info {
  font-size: 12px;
  color: var(--gray-500);
  margin-left: auto;
}

/* Errors */
.error-list { list-style: none; margin: 0; padding: 0; }
.error-list li { padding: 4px 0; font-size: 12px; color: #991b1b; }
.error-list li::before { content: "• "; }

/* ── Report Header ── */
.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.report-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-title-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.report-title-edit-btn:hover { color: var(--primary); }
.chart-period-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chart-period-btn:hover { border-color: #2563eb; color: #2563eb; }
.chart-period-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }
.report-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--gray-700);
}
.report-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.report-meta-sep { color: var(--gray-300); }
.report-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Dashboard grid ── */
.dashboard-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin-bottom: 10px;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.dash-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.dash-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.dash-neutral::before { background: var(--navy); }
.dash-danger::before  { background: #dc2626; }
.dash-warning::before { background: #d97706; }
.dash-success::before { background: #16a34a; }
.dash-blue::before    { background: var(--accent); }
.dash-danger-dark::before  { background: #991b1b; }
.dash-warning-dark::before { background: #92400e; }
.dash-yellow-green::before { background: #65a30d; }
.dash-orange::before       { background: #ea580c; }

.dash-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.dash-icon-neutral { background: #eef2ff; color: var(--navy); }
.dash-icon-danger  { background: #fef2f2; color: #dc2626; }
.dash-icon-warning { background: #fffbeb; color: #d97706; }
.dash-icon-success { background: #f0fdf4; color: #16a34a; }
.dash-icon-blue    { background: #eff6ff; color: var(--accent); }
.dash-icon-orange  { background: #fff7ed; color: #ea580c; }

.dash-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.dash-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}
.dash-sublabel {
  font-size: 11px;
  color: var(--gray-400);
}

/* ── Dashboard tab — compact tile overrides ── */
#tab-dashboard .dash-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
#tab-dashboard .dash-card {
  padding: 12px 12px 10px;
}
#tab-dashboard .dash-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  margin-bottom: 3px;
}
#tab-dashboard .dash-icon svg {
  width: 15px;
  height: 15px;
}
#tab-dashboard .dash-value {
  font-size: 22px;
  letter-spacing: -0.01em;
}
#tab-dashboard .dash-label {
  font-size: 11.5px;
}
#tab-dashboard .dash-sublabel {
  font-size: 10.5px;
}

/* ── Activity trend chart ── */
.trend-chart-wrap {
  position: relative;
  height: 220px;
  margin: 18px 0 8px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-sizing: border-box;
}

/* ── Review alert banner ── */
.review-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 16px;
}

/* ── Tab counts ── */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 5px;
}
.tab-count-neutral { background: var(--gray-200); color: var(--gray-700); }
.tab-count-danger  { background: #fee2e2; color: #dc2626; }
.tab-count-warning { background: #fef3c7; color: #92400e; }
.tab-count-blue    { background: #dbeafe; color: var(--accent); }

/* ── Section intro ── */
.section-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.section-intro-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.section-intro-icon-danger  { background: #fee2e2; color: #dc2626; }
.section-intro-icon-warning { background: #fef3c7; color: #d97706; }
.section-intro-icon-blue    { background: #dbeafe; color: var(--accent); }
.section-intro-title { font-weight: 700; font-size: 14px; color: var(--gray-900); margin-bottom: 2px; }
.section-intro-body  { font-size: 13px; color: var(--gray-500); }

/* ── Group header rows ── */
.group-header-row td { padding: 0; border: none; background: transparent; }
.group-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 4px;
  margin: 6px 0 3px;
}
.group-label-danger  { background: #fee2e2; color: #991b1b; }
.group-label-warning { background: #fef3c7; color: #92400e; }
.group-label-success { background: #dcfce7; color: #166534; }

/* ── Table cell helpers ── */
.row-num  { color: var(--gray-400); font-size: 12px; text-align: right; width: 36px; }
.prop-name { font-weight: 600; }
.col-muted { color: var(--gray-500); }
.col-num   { text-align: center; }

/* ── Row expand toggle ── */
.expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 9px;
  padding: 0 3px 0 0;
  line-height: 1;
  vertical-align: middle;
  transition: transform 0.12s;
  display: inline-block;
  user-select: none;
}
.expand-btn:hover { color: #64748b; }
.expand-btn.open  { transform: rotate(90deg); }

/* ── Row detail panel ── */
tr.detail-expand-row > td {
  padding: 0 !important;
  border-top: none !important;
}
.detail-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 24px;
  padding: 7px 16px 8px 48px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
}
.detail-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  flex: 1 1 200px;
  min-width: 0;
}
.detail-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.detail-lbl {
  color: #94a3b8;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.detail-val { color: #1e293b; font-weight: 500; }
.dp-pill {
  font-size: 10px;
  border-radius: 4px;
  padding: 0 4px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.dp-alias { background: #ede9fe; color: #5b21b6; }
.dp-boom  { background: #dbeafe; color: #1d4ed8; }
.dp-act   { background: #dcfce7; color: #166534; }

.detail-notes {
  flex: 1 1 100%;
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-notes > .detail-lbl { font-size: 10px; }
.detail-note-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 11px;
}
.detail-note-meta {
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 10px;
  min-width: 180px;
}
.detail-note-text {
  color: #1e293b;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Units badge ── */
.units-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.units-large { background: #dbeafe; color: #1d4ed8; font-weight: 700; }

/* ── Boomerang count badge ── */
.boom-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 960px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-bar { gap: 8px; }
  .stat-card { min-width: 100px; }
  .table-controls { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .report-header { flex-direction: column; }
}

/* ─── Log Activity Panel ─────────────────────────────────────────────── */
.log-toggle-btn {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.6;
  white-space: nowrap;
}
.log-toggle-btn:hover { background: #dbeafe; }

.pending-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  vertical-align: middle;
  cursor: default;
}

tr.log-expand-row { background: #f8fafc !important; }
td.log-expand-cell {
  padding: 14px 20px !important;
  border-top: 2px solid #e2e8f0 !important;
}

.log-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.log-panel-section {
  flex: 1;
  min-width: 220px;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
}

.log-panel-official {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.log-panel-pending {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.log-panel-form {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  min-width: 280px;
}

.log-panel-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #1e3a5f;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.log-panel-title-pending { color: #92400e; }

.log-official-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: #374151;
  margin-bottom: 4px;
}
.log-official-note {
  color: #4b5563;
  font-style: italic;
  font-size: 11px;
  max-width: 480px;
  white-space: normal;
  word-break: break-word;
}

.pending-activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 2px;
}
.pending-activity-table th {
  text-align: left;
  padding: 3px 8px;
  font-weight: 700;
  color: #78350f;
  border-bottom: 1px solid #fde68a;
}
.pending-activity-table td {
  padding: 3px 8px;
  border-bottom: 1px solid #fef3c7;
}
tr.pnd-reconciled td { color: #6b7280; }
tr.pnd-open td { color: #374151; font-weight: 500; }

.pnd-status-badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
}
.pnd-open-badge       { background: #fef3c7; color: #92400e; }
.pnd-reconciled-badge { background: #dcfce7; color: #166534; }

.log-form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.log-form-row label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  min-width: 120px;
}
.log-form-row select,
.log-form-row input[type="date"] {
  padding: 4px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
}
.log-form-row textarea {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  padding: 4px 7px;
  background: #fff;
}
.log-form-row-note { margin-bottom: 8px; }
.log-form-actions { display: flex; align-items: center; gap: 8px; }

/* ─── Log Button Badge ───────────────────────────────────────────────── */
.log-btn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  font-size: 9px;
  font-weight: 800;
  background: #fbbf24;
  color: #78350f;
  border-radius: 8px;
  line-height: 1;
  vertical-align: middle;
}
.log-toggle-btn-has-pending {
  background: #fef9c3;
  border-color: #fde68a;
  color: #92400e;
}
.log-toggle-btn-has-pending:hover {
  background: #fef3c7;
}

/* ─── Activity Modal ─────────────────────────────────────────────────── */
body.modal-open { overflow: hidden; }

.activity-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.activity-modal-dialog {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 48px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.activity-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.activity-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--gray-500);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: 12px;
  transition: background 0.12s, color 0.12s;
}
.activity-modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.activity-modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

@media (max-width: 640px) {
  .activity-modal-dialog {
    max-height: 95vh;
    border-radius: 8px;
  }
  .activity-modal-body {
    padding: 12px 14px;
  }
}
