/* SPN Admin Panel — Light theme, forest green accents */

:root {
  --green: #5a9a58;
  --green-light: #e8f3e8;
  --green-dark: #3d7a3b;
  --red: #d95a5a;
  --red-light: #fde8e8;
  --yellow: #e6b422;
  --yellow-light: #fef9e7;
  --blue: #4a90d9;
  --blue-light: #e8f0fb;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Nav --- */
.topnav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 1.5rem;
  height: 56px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--green);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.nav-link.active {
  background: var(--green-light);
  color: var(--green-dark);
}

/* --- Main --- */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* --- Page headers --- */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header p {
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* --- Cards --- */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

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

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.card + .card {
  margin-top: 1rem;
}

/* --- Sections grid --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: #b8860b; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* Status-specific badges */
.status-not-started { background: var(--gray-100); color: var(--gray-600); }
.status-warm-lead { background: var(--red-light); color: var(--red); }
.status-parent-outreach { background: #e8f4fd; color: #2980b9; }
.status-connected { background: var(--blue-light); color: var(--blue); }
.status-assessment-scheduled { background: var(--green-light); color: var(--green); }
.status-assessed { background: var(--yellow-light); color: #b8860b; }
.status-on-hold { background: #fef0e0; color: #e67e22; }

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-200);
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem;
}

.data-table tr:hover {
  background: var(--gray-50);
}

.data-table a {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 500;
}

.data-table a:hover {
  text-decoration: underline;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: white;
  color: var(--red);
  border-color: var(--red);
}

.btn-danger:hover {
  background: var(--red-light);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.3rem;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(90, 154, 88, 0.15);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23737373' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--green);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.25rem;
}

.tab {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.tab:hover {
  color: var(--gray-700);
}

.tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* --- Pipeline / Kanban --- */
.pipeline-summary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.pipeline-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--gray-200);
  min-width: 100px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.pipeline-count:hover {
  border-color: var(--green);
}

.pipeline-count .count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.pipeline-count .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-align: center;
}

.kanban {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: 400px;
}

.kanban-column {
  flex: 0 0 260px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.kanban-column-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--gray-300);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.kanban-column-header .col-count {
  background: var(--gray-200);
  padding: 0 0.4rem;
  border-radius: 9999px;
  font-size: 0.75rem;
}

.kanban-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: grab;
  transition: box-shadow 0.15s;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
  opacity: 0.5;
}

.kanban-card-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.kanban-card-title a {
  color: inherit;
  text-decoration: none;
}

.kanban-card-title a:hover {
  color: var(--green-dark);
}

.kanban-card-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* --- Follow-up queue --- */
.followup-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem;
  border-left: 3px solid var(--gray-300);
  background: white;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 0.5rem;
}

.followup-card.overdue {
  border-left-color: var(--red);
  background: var(--red-light);
}

.followup-card.today {
  border-left-color: var(--yellow);
  background: var(--yellow-light);
}

.followup-card.upcoming {
  border-left-color: var(--green);
}

.followup-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.followup-info h3 a {
  color: inherit;
  text-decoration: none;
}

.followup-info h3 a:hover {
  color: var(--green-dark);
}

.followup-info p {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

.followup-date {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Timeline --- */
.timeline {
  border-left: 2px solid var(--gray-200);
  padding-left: 1.25rem;
  margin-left: 0.5rem;
}

.timeline-entry {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -1.6rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid white;
}

.timeline-entry-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.timeline-entry-date {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.timeline-entry-summary {
  font-weight: 600;
  font-size: 0.9rem;
}

.timeline-entry-body {
  font-size: 0.85rem;
  color: var(--gray-600);
}

/* --- Detail page header --- */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.detail-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.detail-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.detail-meta-item {
  font-size: 0.85rem;
}

.detail-meta-item .meta-label {
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-meta-item .meta-value {
  font-weight: 500;
}

/* --- Stats row --- */
.stat-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--gray-500);
  text-transform: uppercase;
}

/* --- View toggle --- */
.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle button {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
}

.view-toggle button + button {
  border-left: 1px solid var(--gray-300);
}

.view-toggle button.active {
  background: var(--green-light);
  color: var(--green-dark);
}

/* --- Search/filter bar --- */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-bar .form-control {
  width: auto;
  min-width: 180px;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}

.empty-state p {
  font-size: 0.9rem;
}

/* --- Inline form toggle --- */
.inline-form {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

.inline-form.open {
  display: block;
}

/* --- Utilities --- */
.text-muted { color: var(--gray-500); }
.text-small { font-size: 0.8rem; }
.text-bold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none; }
