/* =========================================================================
   CareTrust DPC Platform — MVP stylesheet
   Palette pulled from the approved mockups:
     Primary blue   #2C5CE0   (buttons, links, brand)
     Deep navy      #16305C   (headings)
     Success green  #16A34A   (Executive Care Center accents, checks)
     Warning amber  #D97706   (moderate risk)
     Surface        #F4F6FB   (app background)
     Card white     #FFFFFF
   ========================================================================= */

:root {
  --blue: #2C5CE0;
  --blue-dark: #1E4FD6;
  --navy: #16305C;
  --green: #16A34A;
  --green-bg: #ECFDF3;
  --amber: #D97706;
  --amber-bg: #FFFBEB;
  --red: #DC2626;
  --surface: #F4F6FB;
  --card: #FFFFFF;
  --border: #E5E9F2;
  --text: #17233D;
  --text-mute: #6B7690;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Noto Sans SC", "Noto Sans JP", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Phone-frame container: full width on mobile, centered card on desktop */
.phone-frame {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 640px) {
  body { background: #E7EAF3; }
  .phone-frame {
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(22, 48, 92, 0.18);
    overflow: hidden;
    border: 1px solid var(--border);
  }
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar-brand { display: flex; align-items: center; gap: 8px; }

.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}

.brand-name { font-weight: 700; font-size: 17px; color: var(--navy); }

.lang-switch select {
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* ---------- Enrollment progress dots ---------- */
.progress-track {
  display: flex;
  gap: 6px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}
.progress-dot.is-active { background: var(--blue); }
.progress-dot.is-current { background: var(--blue-dark); }

/* ---------- Page content ---------- */
.page-content {
  flex: 1;
  padding: 22px 20px 100px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 6px;
}

h1.page-title {
  font-size: 24px;
  line-height: 1.3;
  color: var(--navy);
  margin: 0 0 6px;
}

p.page-subtitle {
  font-size: 14.5px;
  color: var(--text-mute);
  margin: 0 0 22px;
}

/* ---------- Form elements ---------- */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=date],
.field input[type=number],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.chip input { display: none; }
.chip.is-selected, .chip:has(input:checked) {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.switch { position: relative; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 20px; height: 20px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.radio-row { display: flex; gap: 10px; }
.radio-pill {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
}
.radio-pill input { margin-right: 6px; }
.radio-pill:has(input:checked) { border-color: var(--blue); background: #EEF2FF; color: var(--blue-dark); font-weight: 600; }

.footnote {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 18px;
  text-align: center;
}

.helper-text { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 15.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--card); color: var(--blue); border: 1px solid var(--blue); }
.btn-ghost { background: transparent; color: var(--blue); font-weight: 600; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; width: auto; border-radius: 999px; }

.sticky-cta {
  position: sticky;
  bottom: 0;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--surface) 60%, transparent);
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.icon-badge {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #EEF2FF;
  color: var(--blue);
  font-size: 18px;
  flex-shrink: 0;
}
.icon-badge.green { background: var(--green-bg); color: var(--green); }

.plan-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  position: relative;
  background: var(--card);
}
.plan-card.is-selected, .plan-card.is-top {
  border-color: var(--blue);
  box-shadow: 0 8px 24px rgba(44,92,224,.14);
}
.plan-badge {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.plan-name { font-size: 17px; font-weight: 700; color: var(--navy); }
.plan-price { font-size: 22px; font-weight: 800; color: var(--navy); margin: 6px 0; }
.plan-price span { font-size: 13px; font-weight: 500; color: var(--text-mute); }
.plan-feature-list { list-style: none; margin: 10px 0; padding: 0; }
.plan-feature-list li {
  font-size: 13.5px;
  padding: 4px 0 4px 22px;
  position: relative;
  color: var(--text);
}
.plan-feature-list li::before {
  content: "✓";
  position: absolute; left: 0; top: 4px;
  color: var(--green); font-weight: 800;
}

.option-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--border);
  font-size: 14px;
}
.option-row strong { color: var(--navy); }

/* ---------- AI analysis (step 4) ---------- */
.ring-wrap { display: flex; justify-content: center; margin: 20px 0; }
.ring {
  width: 150px; height: 150px; border-radius: 50%;
  background: conic-gradient(var(--blue) calc(var(--pct,85) * 1%), var(--border) 0);
  display: flex; align-items: center; justify-content: center;
}
.ring-inner {
  width: 118px; height: 118px; border-radius: 50%;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; color: var(--navy);
}

.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0; border-top: 1px solid var(--border);
  font-size: 14px;
}
.stat-row:last-child { border-bottom: 1px solid var(--border); }
.stat-value { font-weight: 700; color: var(--navy); }
.badge-risk {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-risk.moderate { background: var(--amber-bg); color: var(--amber); }
.badge-risk.low { background: var(--green-bg); color: var(--green); }
.badge-risk.high { background: #FEE2E2; color: var(--red); }
.badge-gap { color: var(--red); font-weight: 700; }

/* ---------- Payment (step 7) ---------- */
.pay-option {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px; margin-bottom: 10px; cursor: pointer;
}
.pay-option:has(input:checked) { border-color: var(--blue); background: #EEF2FF; }
.pay-option input { width: 18px; height: 18px; accent-color: var(--blue); }

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-mute); margin: 16px 0; }
.checkbox-row input { margin-top: 3px; accent-color: var(--blue); }

/* ---------- Care Navigation home ---------- */
.hello-block { margin-bottom: 18px; }
.hello-block h1 { margin-bottom: 4px; }

.map-card {
  background: linear-gradient(135deg, #2C5CE0, #4C7CF0);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
}
.map-card h3 { margin: 0 0 4px; font-size: 16px; }
.map-card p { margin: 0 0 14px; font-size: 13px; opacity: .9; }
.map-card a.btn { background: #fff; color: var(--blue-dark); width: auto; display: inline-block; padding: 9px 16px; }

.next-step-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-top: 1px solid var(--border);
}
.next-step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---------- Search / filters (CN-2) ---------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 14px; background: var(--card); margin-bottom: 14px;
}
.search-box input { border: none; outline: none; flex: 1; font-size: 14px; font-family: var(--font); background: transparent; }

.filter-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 6px; }
.filter-tab {
  flex-shrink: 0;
  padding: 8px 14px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--border); background: var(--card); color: var(--text-mute);
}
.filter-tab.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

.provider-card { display: flex; gap: 12px; align-items: flex-start; }
.provider-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #E8ECF7; color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.provider-name { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.provider-meta { font-size: 12.5px; color: var(--text-mute); margin-top: 2px; }
.tag-network {
  display: inline-block; font-size: 11px; color: var(--green);
  background: var(--green-bg); padding: 2px 8px; border-radius: 999px; margin-top: 6px;
}

/* ---------- Calendar (CN-4) ---------- */
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; }
.date-cell {
  flex-shrink: 0; width: 52px; padding: 10px 0; text-align: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card);
  font-size: 12.5px; cursor: pointer;
}
.date-cell .dow { color: var(--text-mute); font-size: 11px; }
.date-cell .num { font-weight: 700; font-size: 15px; color: var(--navy); }
.date-cell.is-selected { background: var(--blue); border-color: var(--blue); }
.date-cell.is-selected .dow, .date-cell.is-selected .num { color: #fff; }

.time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.time-slot {
  text-align: center; padding: 11px 0; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); font-size: 13.5px; cursor: pointer;
}
.time-slot.is-selected { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }

/* ---------- Care navigator card (CN-6) ---------- */
.navigator-card { text-align: center; }
.navigator-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: #E8ECF7; color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 24px; margin: 0 auto 10px;
}
.navigator-actions { display: flex; gap: 10px; margin-top: 14px; }
.navigator-actions .btn { flex: 1; }

.help-list { list-style: none; margin: 0; padding: 0; }
.help-list li {
  padding: 11px 0 11px 26px; border-top: 1px solid var(--border);
  font-size: 14px; position: relative;
}
.help-list li::before { content: "•"; position: absolute; left: 8px; color: var(--blue); font-weight: 800; }

/* ---------- Confirmation (CN-7) ---------- */
.success-badge {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 6px auto 16px;
}
.detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.detail-row:first-child { border-top: none; }
.detail-label { color: var(--text-mute); }
.detail-value { font-weight: 600; color: var(--navy); text-align: right; }

/* ---------- Bottom nav ---------- */
body.has-bottom-nav .page-content { padding-bottom: 90px; }

.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bn-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-mute);
}
.bn-item.is-active { color: var(--blue); font-weight: 700; }
.bn-icon { font-size: 19px; }

/* ---------- Home (landing / non-app) ---------- */
.landing-hero { text-align: center; padding: 40px 10px; }
.landing-hero .brand-mark { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; margin-bottom: 16px; }
.landing-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
