/* === CervAssist Web - Design System === */
:root {
  --primary:       #3B1FA8;
  --primary-dark:  #1A0A4E;
  --primary-light: #6B4FCC;
  --accent:        #00D4AA;
  --bg:            #F5F7FF;
  --card:          #ffffff;
  --text:          #1A1A2E;
  --subtext:       #374151;
  --muted:         #6B7280;
  --placeholder:   #9CA3AF;
  --border:        #E5E7EB;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --success:       #10B981;
  --shadow:        0 2px 8px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.10), 0 3px 8px rgba(0,0,0,0.06);
  --gradient:      linear-gradient(135deg, #1A0A4E 0%, #3B1FA8 55%, #6B4FCC 100%);
  --radius:        16px;
  --radius-sm:     10px;
  --radius-lg:     24px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* === UTILITY === */
.hidden { display: none !important; }
.flex   { display: flex; }
.grid   { display: grid; }
.center { align-items: center; justify-content: center; }

/* === TOP NAV === */
.topnav {
  background: var(--gradient);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(59,31,168,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
}
.topnav-brand .brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.topnav-brand span { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.topnav-user { font-size: 13px; color: rgba(255,255,255,0.8); }
.topnav-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 20px; cursor: pointer;
  transition: background 0.2s;
}
.topnav-btn:hover { background: rgba(255,255,255,0.25); }

/* Tab nav (worker) */
.tab-nav {
  display: flex; gap: 4px;
}
.tab-btn {
  background: transparent; border: none;
  color: rgba(255,255,255,0.65); font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 20px; cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover  { color: #fff; background: rgba(255,255,255,0.1); }
.tab-btn.active { color: #fff; background: rgba(255,255,255,0.2); }

/* === PAGE WRAPPER === */
.page { max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }
.page-wide { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

/* === GRADIENT HEADER BLOCK === */
.page-header {
  background: var(--gradient);
  border-radius: var(--radius-lg);
  padding: 32px 28px 52px;
  margin-bottom: -28px;
  position: relative;
}
.page-header h1 { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.page-header p  { font-size: 13px; color: rgba(255,255,255,0.75); }

/* === CARDS === */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-section { position: relative; padding-top: 32px; }

.section-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-bottom: 14px;
}

/* === GRID LAYOUTS === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

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

/* === KPI CARD === */
.kpi-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.kpi-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.kpi-value { font-size: 32px; font-weight: 800; margin-bottom: 2px; }
.kpi-label { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* === SERVICE CARD === */
.service-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none; display: block;
}
.service-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.service-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 12px;
}
.service-title    { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.service-subtitle { font-size: 12px; color: var(--muted); }

/* === FORMS === */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--subtext); margin-bottom: 7px;
}
.form-input {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text); background: var(--card);
  outline: none; transition: border-color 0.2s;
  font-family: inherit;
}
.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--placeholder); }

.input-row {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); overflow: hidden;
  transition: border-color 0.2s;
}
.input-row:focus-within { border-color: var(--primary); }
.input-icon { padding: 0 12px; font-size: 15px; color: var(--placeholder); flex-shrink: 0; display: flex; align-items: center; }
.input-row input {
  flex: 1; padding: 13px 12px 13px 0;
  border: none; outline: none;
  font-size: 15px; color: var(--text); background: transparent;
  font-family: inherit;
}
.input-row input::placeholder { color: var(--placeholder); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px 24px;
  border-radius: var(--radius-sm); border: none;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none; font-family: inherit;
}
.btn:hover   { opacity: 0.9; }
.btn:active  { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-full    { width: 100%; }

.btn-primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  color: #fff; box-shadow: 0 3px 12px rgba(59,31,168,0.3);
}
.btn-accent  { background: var(--accent); color: #fff; }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-danger  { background: #FEE2E2; color: var(--danger); border: 1.5px solid #FECACA; }
.btn-sm { padding: 9px 18px; font-size: 13px; }

/* === YES/NO BUTTONS === */
.yesno-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.yesno-btn {
  padding: 9px 24px; border-radius: 20px;
  border: 1.5px solid var(--border); background: #F9FAFB;
  font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.yesno-btn.active-yes { background: var(--primary); border-color: var(--primary); color: #fff; }
.yesno-btn.active-no  { background: var(--muted);   border-color: var(--muted);   color: #fff; }

/* === TOGGLE SWITCH === */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.toggle-label { font-size: 14px; color: var(--subtext); font-weight: 500; }
.toggle {
  position: relative; width: 46px; height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 13px;
  background: var(--border); cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked ~ .toggle-slider { background: var(--primary); }
.toggle input:checked ~ .toggle-slider::before { transform: translateX(20px); }

/* === PROGRESS BAR === */
.progress-bar { display: flex; gap: 8px; margin-top: 16px; }
.progress-dot {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.3);
  transition: background 0.3s;
}
.progress-dot.active { background: var(--accent); }

/* === RISK BADGE === */
.risk-badge {
  display: flex; align-items: flex-start; gap: 14px;
  border-radius: var(--radius); border-width: 1.5px; border-style: solid;
  padding: 18px; margin-bottom: 16px;
}
.risk-badge-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.risk-badge-label { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.risk-badge-msg   { font-size: 13px; line-height: 1.55; font-weight: 500; }

/* === INFO BOX === */
.info-box {
  background: #EDE9FF; border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 12px;
  font-size: 12px; color: var(--primary); line-height: 1.6;
}
.note-box {
  background: #F9FAFB; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 13px; color: var(--muted); line-height: 1.6;
  display: flex; gap: 10px; align-items: flex-start;
}
.warning-box {
  background: #FFFBEB; border: 1px solid #FDE68A;
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 12px; color: #92400E; line-height: 1.6;
  display: flex; gap: 8px; align-items: flex-start;
}

/* === EMAIL CARD === */
.email-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.email-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.email-icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  background: #EDE9FF; display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.email-sent-box {
  display: flex; align-items: center; gap: 10px;
  background: #D1FAE5; border-radius: var(--radius-sm); padding: 12px;
  font-size: 13px; color: #065F46; font-weight: 500;
}

/* === UPLOAD AREA === */
.upload-area {
  border: 2px dashed var(--primary); border-radius: var(--radius-sm);
  padding: 28px; text-align: center; cursor: pointer;
  background: #EDE9FF; transition: background 0.2s;
  margin-bottom: 12px;
}
.upload-area:hover { background: #E0DAFF; }
.upload-area.has-file { border-color: var(--accent); background: #E6FAF6; }
.upload-area .upload-icon { font-size: 32px; margin-bottom: 8px; display: block; }
.upload-area .upload-text { font-size: 15px; font-weight: 600; color: var(--primary); }
.upload-area.has-file .upload-text { color: var(--accent); }

/* === COVERAGE LIST === */
.coverage-card {
  background: var(--card); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
}
.coverage-dot {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; border-width: 1.5px; border-style: solid;
}
.coverage-info { flex: 1; min-width: 0; }
.coverage-name   { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.coverage-coords { font-size: 11px; color: var(--placeholder); margin-bottom: 6px; }
.badge-row { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  border-radius: 20px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
}

/* === SHAP FEATURES === */
.shap-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.shap-bullet {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; margin-top: 1px;
}

/* === SPINNER === */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === LANDING PAGE === */
.landing-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 420px;
}
.landing-hero {
  background: var(--gradient);
  padding: 60px 48px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.landing-hero::after {
  content: '';
  position: absolute; right: -60px; bottom: -60px;
  width: 280px; height: 280px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}
.hero-logo {
  display: flex; align-items: center; gap: 14px; margin-bottom: 48px;
}
.hero-logo-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.hero-logo-name { font-size: 28px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.hero-tagline { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.hero-title {
  font-size: 44px; font-weight: 800; color: #fff;
  line-height: 1.15; letter-spacing: -1px; margin-bottom: 20px;
}
.hero-title span { color: var(--accent); }
.hero-subtitle { font-size: 16px; color: rgba(255,255,255,0.75); line-height: 1.7; margin-bottom: 48px; max-width: 480px; }
.hero-features { display: flex; flex-direction: column; gap: 14px; }
.hero-feature {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.1); border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.hero-feature-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255,255,255,0.15); display: flex;
  align-items: center; justify-content: center; font-size: 18px;
}
.hero-feature-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.hero-feature-sub   { font-size: 12px; color: rgba(255,255,255,0.65); }

.landing-auth {
  background: var(--bg); padding: 48px 36px;
  display: flex; flex-direction: column; justify-content: center;
}
.auth-tabs {
  display: flex; gap: 4px; background: var(--card);
  border-radius: 14px; padding: 4px; margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.auth-tab {
  flex: 1; padding: 11px; border-radius: 11px; border: none;
  font-size: 15px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: transparent;
  transition: all 0.2s; font-family: inherit;
}
.auth-tab.active { background: var(--primary); color: #fff; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .landing-layout { grid-template-columns: 1fr; }
  .landing-hero { padding: 40px 24px; min-height: 50vh; }
  .hero-title { font-size: 32px; }
  .landing-auth { padding: 32px 20px; }
  .page, .page-wide { padding: 20px 16px 60px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* === TOAST === */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text); color: #fff;
  padding: 14px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 9999;
  animation: slideUp 0.3s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === IMAGE PREVIEW === */
.img-preview {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: var(--radius-sm); margin-bottom: 12px;
}

/* Smooth section transitions */
.section-panel { animation: fadeIn 0.25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === HISTORY FILTER CHIPS === */
.hist-filter {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.hist-filter.active,
.hist-filter:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* === CLINICIAN FORM (app-style) === */
.clin-header {
  background: linear-gradient(135deg, #1A0A4E 0%, #3B1FA8 100%);
  padding: 28px 24px 48px;
}
.clin-header-inner { max-width: 720px; margin: auto; }

.clin-body {
  max-width: 720px;
  margin: -24px auto 0;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 28px 24px 48px;
}

/* Section header card */
.sec-header-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 20px 0 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.sec-header-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--sec-icon-bg, #EDE9FF);
  color: var(--sec-icon-color, #3B1FA8);
  font-size: 16px; flex-shrink: 0;
}
.sec-header-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.sec-header-sub   { font-size: 12px; color: var(--muted); }

/* Question card */
.q-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.q-label { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 4px; }
.q-hint  { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }

/* Yes/No buttons */
.yn-row { display: flex; gap: 10px; margin-top: 10px; }
.yn-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: 22px; border: 1.5px solid var(--border);
  background: var(--notesBg, #F9FAFB); color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.yn-btn.yn-no-active  { background: #6B7280; color: #fff; border-color: #6B7280; }
.yn-btn.yn-yes-active { background: #3B1FA8; color: #fff; border-color: #3B1FA8; }

/* Number stepper */
.stepper-row  { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.stepper-btn  {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--notesBg, #F9FAFB);
  font-size: 22px; font-weight: 300; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text);
}
.stepper-btn:hover { background: var(--border); }
.stepper-input {
  width: 72px; text-align: center; font-size: 18px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 8px 4px; background: var(--notesBg, #F9FAFB); color: var(--text);
}

/* VIA upload area */
.via-upload-area {
  border: 2px dashed #3B1FA8; border-radius: 14px;
  background: #EDE9FF; padding: 24px 20px;
  text-align: center; cursor: pointer; transition: all 0.15s;
}
.via-upload-area:hover { background: #DDD6FE; }
.via-upload-area.has-file { border-color: #10B981; background: #ECFDF5; }
.via-upload-icon { font-size: 26px; color: #3B1FA8; margin-bottom: 6px; }
.via-upload-text { font-size: 14px; font-weight: 600; color: #3B1FA8; }

/* Submit button */
.clin-submit-btn {
  width: 100%; margin-top: 20px;
  padding: 17px; border-radius: 14px; border: none;
  background: linear-gradient(to right, #3B1FA8, #6B4FCC);
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 3px 12px rgba(59,31,168,0.3); transition: opacity 0.15s;
}
.clin-submit-btn:hover { opacity: 0.9; }

/* Result cards */
.result-risk-badge {
  display: flex; align-items: center; gap: 10px;
  border-radius: 14px; border: 1.5px solid; padding: 16px 20px; margin-bottom: 16px;
}
.result-risk-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.result-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 18px; margin-bottom: 14px;
}
.result-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.result-card-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.result-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; }
