/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8fafc; color: #1e293b; line-height: 1.5; }

/* ── Patient intake shell ──────────────────────────────────── */
.intake-shell { min-height: 100dvh; display: flex; flex-direction: column; background: #fff; max-width: 480px; margin: 0 auto; }
.intake-header { background: #2563eb; color: #fff; padding: 16px 20px 14px; }
.intake-header .clinic { font-size: 12px; opacity: .8; margin-bottom: 2px; }
.intake-header h1 { font-size: 18px; font-weight: 600; }
.progress-bar { height: 3px; background: rgba(255,255,255,.25); }
.progress-fill { height: 100%; background: #fff; border-radius: 0 2px 2px 0; transition: width .4s ease; }
.intake-body { flex: 1; padding: 28px 20px 20px; }
.intake-footer { padding: 16px 20px; border-top: 1px solid #f1f5f9; }
.step-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #64748b; margin-bottom: 6px; }
.intake-body h2 { font-size: 22px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.intake-body .sub { font-size: 14px; color: #64748b; margin-bottom: 24px; }

/* ── Form elements ─────────────────────────────────────────── */
.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.field-group .optional { font-weight: 400; color: #9ca3af; font-size: 11px; margin-left: 4px; }
.field-group input, .field-group select, .field-group textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1.5px solid #e2e8f0;
  border-radius: 10px; background: #fff; color: #0f172a; outline: none;
  transition: border-color .15s, box-shadow .15s; appearance: none;
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus {
  border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.field-group textarea { resize: vertical; min-height: 80px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn { display: block; width: 100%; padding: 14px; font-size: 16px; font-weight: 600; border-radius: 12px; border: none; cursor: pointer; text-align: center; text-decoration: none; transition: opacity .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-outline { background: transparent; color: #2563eb; border: 1.5px solid #2563eb; margin-top: 10px; }
.btn-secondary { background: #f1f5f9; color: #475569; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Review card ───────────────────────────────────────────── */
.review-section { background: #f8fafc; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.review-section h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #2563eb; margin-bottom: 10px; }
.review-row { display: flex; gap: 8px; margin-bottom: 6px; }
.review-row .rl { font-size: 12px; color: #64748b; width: 110px; flex-shrink: 0; }
.review-row .rv { font-size: 13px; color: #0f172a; font-weight: 500; }
.check-list { list-style: none; }
.check-list li { font-size: 13px; color: #166534; padding: 3px 0; }
.check-list li::before { content: '✓ '; font-weight: 700; }
.check-list li.missing { color: #b45309; }
.check-list li.missing::before { content: '⚠ '; }

/* ── Complete page ─────────────────────────────────────────── */
.complete-wrap { text-align: center; padding: 60px 24px; }
.complete-icon { width: 72px; height: 72px; background: #dcfce7; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 32px; }
.complete-wrap h2 { font-size: 24px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.complete-wrap p { font-size: 15px; color: #64748b; line-height: 1.6; }

/* ── Welcome / step 1 ──────────────────────────────────────── */
.welcome-wrap { text-align: center; padding: 40px 20px 20px; }
.welcome-wrap .logo { width: 64px; height: 64px; background: #eff6ff; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 30px; }
.welcome-wrap h2 { font-size: 24px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.welcome-wrap p { font-size: 15px; color: #64748b; margin-bottom: 28px; line-height: 1.6; }
.steps-preview { text-align: left; background: #f8fafc; border-radius: 12px; padding: 16px; margin-bottom: 24px; }
.steps-preview .sp-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: #475569; }
.steps-preview .sp-num { width: 22px; height: 22px; background: #2563eb; color: #fff; border-radius: 50%; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hipaa-note { font-size: 11px; color: #94a3b8; margin-top: 12px; text-align: center; }

/* ── Upload area ───────────────────────────────────────────── */
.upload-area { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 20px; text-align: center; color: #64748b; font-size: 13px; cursor: pointer; transition: border-color .15s; }
.upload-area:hover { border-color: #2563eb; color: #2563eb; }
.upload-area .ua-icon { font-size: 28px; margin-bottom: 6px; }
.upload-note { font-size: 11px; color: #94a3b8; margin-top: 8px; }

/* ── Dashboard ─────────────────────────────────────────────── */
.dash-shell { min-height: 100vh; background: #f1f5f9; }
.dash-nav { background: #1e3a8a; color: #fff; padding: 0 24px; display: flex; align-items: center; height: 56px; gap: 16px; }
.dash-nav .brand { font-size: 16px; font-weight: 700; color: #fff; text-decoration: none; }
.dash-nav .brand span { font-weight: 400; opacity: .7; font-size: 13px; margin-left: 6px; }
.dash-nav .live-dot { width: 8px; height: 8px; background: #4ade80; border-radius: 50%; margin-left: auto; }
.dash-nav .nav-links { display: flex; gap: 4px; }
.dash-nav a { color: rgba(255,255,255,.75); font-size: 13px; text-decoration: none; padding: 6px 10px; border-radius: 6px; transition: background .15s; }
.dash-nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.dash-main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 16px 18px; border: 1px solid #e2e8f0; }
.stat-card .sc-num { font-size: 28px; font-weight: 700; color: #0f172a; }
.stat-card .sc-label { font-size: 11px; color: #64748b; margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.stat-card.blue .sc-num { color: #2563eb; }
.stat-card.green .sc-num { color: #16a34a; }
.stat-card.amber .sc-num { color: #d97706; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { flex: 1; min-width: 180px; padding: 9px 14px; font-size: 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; outline: none; }
.search-box:focus { border-color: #2563eb; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pills a { font-size: 12px; padding: 6px 12px; border-radius: 20px; border: 1px solid #e2e8f0; color: #475569; text-decoration: none; background: #fff; transition: all .15s; }
.filter-pills a.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.patient-table { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; }
.pt-header { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 120px; gap: 0; padding: 10px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.pt-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 120px; align-items: center; gap: 0; padding: 14px 20px; border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.pt-row:last-child { border-bottom: none; }
.pt-row:hover { background: #f8fafc; }
.pt-name { font-weight: 600; font-size: 14px; color: #0f172a; }
.pt-sub { font-size: 11px; color: #94a3b8; margin-top: 1px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.badge-complete { background: #dcfce7; color: #15803d; }
.badge-progress { background: #fef9c3; color: #a16207; }
.badge-incomplete { background: #fef2f2; color: #b91c1c; }
.pt-actions { display: flex; gap: 6px; }
.btn-sm { font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; color: #374151; cursor: pointer; text-decoration: none; transition: all .15s; }
.btn-sm:hover { border-color: #2563eb; color: #2563eb; }
.btn-sm.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-sm.primary:hover { opacity: .9; }
.empty-state { text-align: center; padding: 48px 24px; color: #94a3b8; font-size: 14px; }
/* Dashboard login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f1f5f9; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px; border: 1px solid #e2e8f0; }
.login-card .lc-logo { text-align: center; margin-bottom: 28px; }
.login-card .lc-logo h1 { font-size: 20px; font-weight: 700; color: #0f172a; margin-top: 10px; }
.login-card .lc-logo p { font-size: 13px; color: #64748b; }
/* QR page */
.qr-wrap { text-align: center; padding: 40px 24px; }
.qr-wrap h2 { font-size: 22px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.qr-wrap p { font-size: 14px; color: #64748b; margin-bottom: 24px; }
.qr-card { display: inline-block; background: #fff; border-radius: 16px; padding: 24px; border: 2px solid #e2e8f0; }
.qr-url { font-size: 12px; color: #64748b; margin-top: 12px; word-break: break-all; }
/* Patient detail */
.detail-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 24px; margin-bottom: 16px; }
.detail-card h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #2563eb; margin-bottom: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dg-item .dg-label { font-size: 11px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.dg-item .dg-val { font-size: 14px; color: #0f172a; font-weight: 500; margin-top: 2px; }

@media (max-width: 768px) {
  .pt-header { display: none; }
  .pt-row { grid-template-columns: 1fr auto; gap: 8px; }
  .pt-row > *:nth-child(2), .pt-row > *:nth-child(3), .pt-row > *:nth-child(4) { display: none; }
  .dash-main { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
}
