/* Continuum Account Hit List Dashboard */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #1a2744;
  --navy-dark: #0f1a30;
  --navy-mid: #243560;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --text: #111827;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

/* ── Header ─────────────────────────────────────────────────────── */
.header {
  background: var(--navy-dark);
  color: white;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-left .subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-updated {
  font-size: 11px;
  color: #94a3b8;
}

.last-updated span {
  color: #60a5fa;
  font-weight: 600;
}

/* ── Access Denied ─────────────────────────────────────────────── */
#access-denied {
  display: none;
  min-height: 100vh;
  background: var(--navy-dark);
  color: white;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

#access-denied.visible {
  display: flex;
}

#access-denied .lock-icon {
  font-size: 56px;
  opacity: 0.6;
}

#access-denied h2 {
  font-size: 22px;
  font-weight: 700;
}

#access-denied p {
  font-size: 14px;
  color: #94a3b8;
  max-width: 380px;
}

/* ── Loading ────────────────────────────────────────────────────── */
#loading {
  display: none;
  min-height: 80vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--gray-600);
}

#loading.visible {
  display: flex;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Main content ───────────────────────────────────────────────── */
#main-content { display: none; }
#main-content.visible { display: block; }

/* ── Summary pills ──────────────────────────────────────────────── */
.summary-bar {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.stat-pill {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.stat-pill .pill-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.stat-pill .pill-label {
  color: var(--gray-600);
}

.stat-pill.financial { border-color: #93c5fd; }
.stat-pill.education { border-color: #86efac; }
.stat-pill.public { border-color: #fcd34d; }
.stat-pill.interactions { border-color: #c4b5fd; }
.stat-pill.no-interactions { border-color: #fca5a5; }

/* ── Filter bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  padding: 10px 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar label {
  font-size: 11px;
  color: var(--gray-600);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-bar select,
.filter-bar input[type="text"] {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  background: white;
  color: var(--text);
  cursor: pointer;
  outline: none;
  height: 30px;
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-label {
  font-size: 12px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.search-box {
  width: 200px;
}

.btn-clear-filters {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--gray-600);
  cursor: pointer;
  height: 30px;
  transition: all 0.15s;
}

.btn-clear-filters:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Filter result info ─────────────────────────────────────────── */
.filter-info {
  padding: 6px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-info strong { color: var(--navy); }

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  padding: 0 24px;
  background: white;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  gap: 2px;
}

.tab {
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  color: var(--gray-400);
  font-size: 13px;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -2px;
}

.tab:hover { color: var(--navy-mid); }

.tab.active {
  color: var(--navy);
  border-bottom-color: var(--accent);
}

.tab .tab-count {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 5px;
  font-weight: 600;
}

.tab.active .tab-count {
  background: var(--accent);
  color: white;
}

/* ── Table container ────────────────────────────────────────────── */
.content {
  padding: 16px 24px;
}

.section { display: none; }
.section.active { display: block; }

.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th {
  background: var(--navy);
  color: white;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

th:hover { background: var(--navy-mid); }

th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.4;
  font-size: 10px;
}

th.sort-asc .sort-arrow::after { content: "▲"; opacity: 1; }
th.sort-desc .sort-arrow::after { content: "▼"; opacity: 1; }
th:not(.sort-asc):not(.sort-desc) .sort-arrow::after { content: "⇅"; }

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.wrap-cell {
  white-space: normal;
  word-break: break-word;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f0f7ff; }

/* ── Cell types ─────────────────────────────────────────────────── */
a.crm-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
a.crm-link:hover { text-decoration: underline; color: var(--accent-hover); }

a.website-link {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 11px;
}
a.website-link:hover { color: var(--accent); text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-meaningful {
  background: var(--green-bg);
  color: var(--green);
}

.badge-not-meaningful {
  background: var(--red-bg);
  color: var(--red);
}

.badge-yes {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-no {
  background: var(--gray-100);
  color: var(--gray-400);
}

.priority-high {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  font-weight: 600;
}

.priority-medium {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: #fefce8;
  color: #a16207;
  font-size: 11px;
  font-weight: 600;
}

.priority-low {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 600;
}

.score-chip {
  display: inline-block;
  background: var(--navy);
  color: white;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.num-cell { text-align: center; color: var(--navy); font-weight: 600; }

.date-cell { color: var(--gray-600); font-size: 12px; white-space: nowrap; }

.date-recent { color: var(--green); }
.date-old    { color: #d97706; }
.date-very-old { color: var(--red); }
.date-never    { color: var(--gray-400); font-style: italic; }

/* Full history cells */
.history-cell {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  line-height: 1.5;
  max-height: 120px;
  overflow: hidden;
  position: relative;
  max-width: 500px;
}

.history-cell.expanded { max-height: none; }

.history-toggle {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.history-toggle:hover { text-decoration: underline; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--gray-400);
  font-size: 14px;
}

.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header { padding: 10px 14px; }
  .header-left h1 { font-size: 15px; }
  .filter-bar { padding: 8px 14px; }
  .content { padding: 10px 14px; }
  .tabs { padding: 0 14px; }
  .summary-bar { padding: 10px 14px; }
  .filter-info { padding: 6px 14px; }
}

/* ── No print ───────────────────────────────────────────────────── */
@media print {
  .header, .filter-bar, .tabs, .summary-bar { position: static; }
  .table-wrapper { box-shadow: none; }
}
