/* Referral Tracker Dashboard — extends theme.css */

/* Nav link active state */
.nav-referrals.active { color: var(--fg); }

/* Dashboard layout */
.dashboard-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 36px;
}

.dashboard-header h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* KPI cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.kpi-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}

.kpi-value.accent { color: var(--accent-dark); }

.kpi-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Occupancy bar */
.occupancy-bar-wrap {
  margin-top: 10px;
}

.occupancy-bar {
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.occupancy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Pipeline row */
.pipeline-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.pipeline-stage {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  border-top: 3px solid var(--border);
}

.pipeline-stage.pending    { border-top-color: #D4A847; }
.pipeline-stage.reviewed   { border-top-color: var(--accent); }
.pipeline-stage.placed     { border-top-color: var(--accent-dark); }
.pipeline-stage.moved_out  { border-top-color: #4A6E5A; }

.pipeline-stage .stage-count {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 6px;
}

.pipeline-stage .stage-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: capitalize;
}

.pipeline-stage .stage-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  opacity: 0.8;
}

/* Referral table */
.referrals-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.referrals-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.referrals-card-header h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.referral-count-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

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

.referrals-table thead tr {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.referrals-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.referrals-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.referrals-table tbody tr:last-child td { border-bottom: none; }

.referrals-table tbody tr:hover { background: rgba(124, 144, 130, 0.04); }

/* Name cell */
.ref-name {
  font-weight: 500;
  color: var(--fg);
}

/* Category badge */
.cat-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.cat-badge.veteran  { background: #EBF0ED; color: #4A6E5A; }
.cat-badge.survivor { background: #F4EDE5; color: #8A5A2A; }
.cat-badge.senior   { background: #EBEBF5; color: #4A5A8A; }

/* Status badge + dropdown */
.status-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.pending    { background: #F9F3E4; color: #8A6A20; }
.status-badge.reviewed   { background: #EBF0ED; color: #4A6E5A; }
.status-badge.placed     { background: #E4EEF5; color: #2A5A7A; }
.status-badge.moved_out  { background: var(--fg); color: var(--bg); }

.status-select {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: var(--fg);
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: border-color 0.15s;
}

.status-select:hover { border-color: var(--accent); }
.status-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,144,130,0.15); }

/* Date + notes */
.ref-date { color: var(--muted); font-size: 0.85rem; }
.ref-notes {
  max-width: 260px;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-updated { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--fg);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 999;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* Outcomes KPI card */
.outcomes-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 36px;
  border-left: 3px solid var(--accent-dark);
}

.outcomes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.outcomes-title {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.outcomes-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.outcomes-metrics {
  display: flex;
  align-items: center;
  gap: 0;
}

.outcome-metric {
  flex: 1;
  text-align: center;
  padding: 0 12px;
}

.outcome-metric.highlight .outcome-metric-value {
  color: var(--accent-dark);
}

.outcome-metric-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 4px;
}

.outcome-metric-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.outcome-metric-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 8px;
}

/* Outcome badge in table */
.outcome-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.outcome-badge.none     { color: var(--muted); }
.outcome-badge.success  { background: #EBF5EB; color: #2A6E2A; }
.outcome-badge.failure  { background: #F5EBEB; color: #8A2A2A; }
.outcome-badge.pending-outcome {
  background: var(--bg);
  border: 1px dashed var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.outcome-badge.pending-outcome:hover { border-color: var(--accent); color: var(--accent-dark); }
.outcome-badge.success, .outcome-badge.failure { cursor: pointer; }
.outcome-badge.success:hover  { opacity: 0.8; }
.outcome-badge.failure:hover  { opacity: 0.8; }

/* Outcome editor dialog overlay */
.outcome-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 100;
}
.outcome-overlay.show { display: block; }

.outcome-dialog {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 101;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.outcome-dialog.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.outcome-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.outcome-dialog-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.outcome-dialog-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.outcome-dialog-close:hover { background: var(--bg); color: var(--fg); }

.outcome-dialog-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.od-field { display: flex; flex-direction: column; gap: 5px; }

.od-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.od-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.od-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,144,130,0.15); }

.outcome-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
}

.od-btn-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: border-color 0.15s, color 0.15s;
}
.od-btn-cancel:hover { border-color: var(--accent); color: var(--fg); }

.od-btn-save {
  background: var(--accent-dark);
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.875rem;
  color: #fff;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 500;
  transition: opacity 0.15s;
}
.od-btn-save:hover { opacity: 0.88; }

/* Responsive */
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .pipeline-row { grid-template-columns: repeat(2, 1fr); }
  .outcomes-metrics { flex-wrap: wrap; gap: 16px; }
  .outcome-metric-divider { display: none; }
}

@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .pipeline-row { grid-template-columns: 1fr 1fr; }
  .dashboard-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .referrals-table th:nth-child(4), .referrals-table td:nth-child(4) { display: none; }
  .referrals-table th:nth-child(6), .referrals-table td:nth-child(6) { display: none; }
}