/* CareLoop Dashboard — matches landing page design language */

.dashboard-wrap { min-height: 100vh; background: var(--bg); }

/* DASHBOARD HEADER */
.dash-header {
  border-bottom: 1px solid var(--border);
  padding: 0 48px;
  background: white;
}
.dash-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
}
.dash-header .wordmark { color: var(--green); }
.dash-nav { display: flex; gap: 32px; align-items: center; }
.dash-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.dash-nav a:hover, .dash-nav a.active { color: var(--fg); }

/* PAGE LAYOUT */
.dash-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 48px;
}

/* PAGE TITLE */
.page-header { margin-bottom: 40px; }
.page-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 36px;
  color: var(--green);
  margin-bottom: 8px;
}
.page-header p { font-size: 16px; color: var(--fg-muted); }

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
}
.stat-card.alert-card { border-color: #F59E0B; background: #FFFBEB; }
.stat-card .stat-num {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--fg);
  display: block;
  margin-bottom: 4px;
}
.stat-card.alert-card .stat-num { color: #B45309; }
.stat-card .stat-lbl {
  font-size: 13px;
  color: var(--fg-muted);
  display: block;
  font-weight: 500;
}

/* SECTIONS */
.dash-section { margin-bottom: 48px; }
.dash-section h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--green);
  margin-bottom: 20px;
}

/* TABLE */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 16px;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFAF8; }

.patient-name { font-weight: 600; color: var(--fg); }
.patient-email { font-size: 12px; color: var(--fg-muted); display: block; }
.visit-date { font-size: 13px; color: var(--fg-muted); }
.treatment-preview {
  font-size: 13px;
  color: var(--fg-muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-high { background: #FEE2E2; color: #991B1B; }
.badge-medium { background: #FEF3C7; color: #92400E; }
.badge-open { background: #DBEAFE; color: #1E40AF; }
.badge-resolved { background: #D1FAE5; color: #065F46; }
.badge-draft { background: var(--cream); color: var(--fg-muted); }
.badge-sent { background: #D1FAE5; color: #065F46; }

/* ACTION BUTTONS */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--cream); color: var(--fg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: #FEE2E2; color: #991B1B; }
.btn-danger:hover { background: #FECACA; }

/* GENERATE CHECK-IN MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--green);
  margin-bottom: 8px;
}
.modal-meta { font-size: 13px; color: var(--fg-muted); margin-bottom: 20px; }
.message-preview {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.modal-actions { display: flex; gap: 12px; align-items: center; }
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* PATIENT PROGRESS BAR */
.progress-bar-wrap { margin-top: 4px; }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-label { font-size: 11px; color: var(--fg-muted); }

/* CARE PLAN CARDS */
.care-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.care-plan-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.care-plan-card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}
.care-plan-patient { font-size: 12px; color: var(--fg-muted); margin-bottom: 12px; }
.milestone-list { list-style: none; margin: 0; padding: 0; }
.milestone-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--cream);
}
.milestone-item:last-child { border-bottom: none; }
.milestone-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.milestone-check.done { background: var(--accent); border-color: var(--accent); color: white; font-size: 10px; }
.milestone-date { font-size: 11px; color: var(--fg-muted); margin-left: auto; }

/* ALERTS */
.alert-list { display: flex; flex-direction: column; gap: 12px; }
.alert-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.alert-item.high-severity { border-color: #FCA5A5; background: #FEF2F2; }
.alert-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: #DBEAFE;
  color: #1E40AF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.alert-item.high-severity .alert-icon { background: #FEE2E2; color: #991B1B; }
.alert-body { flex: 1; }
.alert-body .alert-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.alert-body .alert-meta { font-size: 12px; color: var(--fg-muted); }
.alert-body .alert-message { font-size: 13px; color: var(--fg-muted); margin-top: 6px; line-height: 1.5; }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-muted);
}
.empty-state p { font-size: 15px; }

/* MOBILE */
@media (max-width: 768px) {
  .dash-header { padding: 0 24px; }
  .dash-content { padding: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .care-plan-grid { grid-template-columns: 1fr; }
  .data-table { font-size: 13px; }
  .data-table td, .data-table th { padding: 10px 12px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}