/* =========================================================
   AI Skin Analysis — Global Design System
   Colors: primary #853DA6, accent #C9A0DC, text #1A1020,
   muted #7A6585, bg #FDFAFF, border #E8D8F2
   Fonts: Cormorant Garamond (headings), DM Sans (body)
   ========================================================= */

:root {
  --primary: #853DA6;
  --primary-dark: #6b2f87;
  --primary-light: #9b57bd;
  --accent: #C9A0DC;
  --text: #1A1020;
  --muted: #7A6585;
  --bg: #FDFAFF;
  --bg-alt: #F6EEFA;
  --border: #E8D8F2;
  --white: #ffffff;
  --success: #4CAF7D;
  --warning: #E0A93A;
  --danger: #D9534F;
  --rose: #E88CA8;
  --shadow-sm: 0 2px 8px rgba(133, 61, 166, 0.08);
  --shadow-md: 0 8px 24px rgba(133, 61, 166, 0.12);
  --shadow-lg: 0 16px 48px rgba(133, 61, 166, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --grad-primary: linear-gradient(135deg, #853DA6 0%, #E88CA8 100%);
  --grad-soft: linear-gradient(135deg, #F6EEFA 0%, #FCE9F0 100%);
  --grad-text: linear-gradient(135deg, #853DA6 0%, #C9A0DC 60%, #E88CA8 100%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--text);
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.9rem, 3.5vw, 2.8rem); }
h3 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
ul { padding-left: 1.2em; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.container-md { max-width: 960px; margin: 0 auto; padding: 0 24px; }

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 0.85rem; }
.text-center { text-align: center; }

/* =========================== Buttons =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, background .2s ease, opacity .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { color: #fff; box-shadow: var(--shadow-lg); }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--bg-alt); color: var(--primary-dark); }
.btn-ghost { background: var(--bg-alt); color: var(--text); }
.btn-white { background: #fff; color: var(--primary); }
.btn-sm { padding: 9px 20px; font-size: 0.9rem; }
.btn-lg { padding: 18px 38px; font-size: 1.1rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* =========================== Header / Nav =========================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253, 250, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; font-weight: 700; color: var(--text); background: none; }
.brand-logo { background: none !important; mix-blend-mode: multiply; }
.brand-mark { color: var(--primary); font-size: 1.3rem; }
.brand-accent { color: var(--primary); }
.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { font-size: 0.95rem; font-weight: 500; color: var(--text); }
.main-nav a.active { color: var(--primary); }
.main-nav a.nav-link-muted { color: var(--muted); }
.nav-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
}
.nav-toggle-checkbox { display: none; }
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  cursor: pointer; width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  transition: background .18s ease;
}
.nav-toggle:hover { background: var(--bg-alt); }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s ease, opacity .25s ease; }
.nav-toggle-checkbox:checked ~ .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle-checkbox:checked ~ .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-toggle-checkbox:checked ~ .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-auth-mobile { display: none; }

/* =========================== Hero =========================== */
.hero {
  position: relative;
  padding: 100px 0 120px;
  overflow: hidden;
  background: radial-gradient(ellipse at top right, #F6EEFA 0%, #FDFAFF 55%), radial-gradient(ellipse at bottom left, #FCE9F0 0%, transparent 60%);
}
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; font-size: 0.85rem; font-weight: 600; color: var(--primary);
  box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.hero h1 { margin-bottom: 20px; }
.hero-sub { font-size: 1.15rem; color: var(--muted); max-width: 520px; margin-bottom: 32px; }
.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 40px; }
.hero-trust { display: flex; gap: 28px; flex-wrap: wrap; }
.hero-trust div { font-size: 0.85rem; color: var(--muted); }
.hero-trust strong { display: block; font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; color: var(--primary); }

.hero-visual {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  border: 1px solid var(--border);
}
.hero-visual .score-ring-wrap { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.hero-visual .mock-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 0.9rem; }
.hero-visual .mock-row:last-child { border-bottom: none; }
.mock-bar { flex: 1; height: 8px; background: var(--bg-alt); border-radius: 999px; margin: 0 12px; overflow: hidden; }
.mock-bar span { display: block; height: 100%; background: var(--grad-primary); border-radius: 999px; }

/* =========================== Sections =========================== */
.section { padding: 104px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 640px; margin: 0 auto 56px; text-align: center; }
.eyebrow {
  display: inline-block; text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.78rem; font-weight: 700; color: var(--primary);
  background: #fff; border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}

/* =========================== Feature Cards =========================== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 12px 36px rgba(133,61,166,0.16); }
.feature-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--grad-soft); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin-bottom: 20px;
}

/* =========================== Steps =========================== */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; counter-reset: step; }
.step { text-align: center; position: relative; }
.step-num {
  width: 52px; height: 52px; border-radius: 50%; background: var(--grad-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem; font-weight: 700; margin: 0 auto 18px; box-shadow: var(--shadow-md);
  position: relative; z-index: 1;
}
/* Connector line between steps — desktop only (4-col layout) */
.steps .step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 26px; left: calc(50% + 26px + 12px);
  width: calc(100% - 52px - 24px);
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0, var(--accent) 6px, transparent 6px, transparent 12px);
  z-index: 0;
}

/* =========================== Pricing =========================== */
.pricing-toggle { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 40px; }
.pricing-card {
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 40px 32px; text-align: center; position: relative; display: flex; flex-direction: column;
}
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 20px 60px rgba(133,61,166,0.22); transform: scale(1.04); }
.pricing-badge {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--grad-primary); color: #fff; padding: 6px 18px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
}
.price-amount { font-family: 'Cormorant Garamond', serif; font-size: 3rem; font-weight: 700; color: var(--primary); margin: 12px 0; }
.price-amount span { font-size: 1rem; color: var(--muted); font-family: 'DM Sans', sans-serif; font-weight: 500; }
.pricing-features { text-align: left; list-style: none; padding: 0; margin: 24px 0 32px; flex-grow: 1; }
.pricing-features li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.pricing-features li:last-child { border-bottom: none; }
.pricing-features li::before { content: "✓ "; color: var(--success); font-weight: 700; }

/* =========================== Dermatologist Preview =========================== */
.derm-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
  text-align: center; box-shadow: var(--shadow-sm);
}
.derm-avatar {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--grad-soft); display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 2rem; color: var(--primary); font-weight: 700;
  overflow: hidden;
}
.derm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.derm-rating { color: var(--warning); font-weight: 700; margin: 8px 0; }
.derm-tag {
  display: inline-block; background: var(--bg-alt); color: var(--primary); font-size: 0.78rem;
  padding: 4px 10px; border-radius: 999px; margin: 2px;
}

/* =========================== Forms =========================== */
.form-page {
  min-height: calc(100vh - 76px);
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #F6EEFA 0%, #FDFAFF 60%);
  padding: 60px 20px;
}
.form-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 48px; width: 100%; max-width: 460px;
}
.form-card.wide { max-width: 640px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--text); }
.form-control {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: 1rem; background: var(--bg); color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(133,61,166,0.12); background: #fff; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }
.form-foot { text-align: center; margin-top: 24px; font-size: 0.92rem; color: var(--muted); }

.alert {
  padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.92rem;
  border: 1px solid transparent;
}
.alert-error { background: #FDECEC; border-color: #F5C2C0; color: #A02622; }
.alert-success { background: #E9F7EF; border-color: #B7E3C5; color: #256B44; }
.alert-info { background: var(--bg-alt); border-color: var(--border); color: var(--primary-dark); }

.plan-select-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 8px; }
.plan-option {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 16px 10px; text-align: center;
  cursor: pointer; transition: all .15s ease; position: relative;
}
.plan-option input { position: absolute; opacity: 0; }
.plan-option.selected, .plan-option:has(input:checked) { border-color: var(--primary); background: var(--bg-alt); }
.plan-option strong { display: block; font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; }

/* =========================== Dashboard =========================== */
.dash-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 36px; flex-wrap: wrap; gap: 16px; }
.usage-widget {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px;
  display: flex; align-items: center; gap: 20px; box-shadow: var(--shadow-sm); min-width: 260px;
}
.usage-ring { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.usage-ring svg { transform: rotate(-90deg); }
.usage-ring .bg { stroke: var(--border); }
.usage-ring .fg { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.usage-ring .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; color: var(--primary); }

.analysis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.analysis-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease; }
.analysis-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.analysis-thumb { width: 100%; height: 170px; object-fit: cover; background: var(--bg-alt); }
.analysis-body { padding: 18px 20px; }
.analysis-score { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.score-pill {
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
  width: 42px; height: 42px; border-radius: 50%; color: #fff; font-family: 'Cormorant Garamond', serif; font-size: 1.1rem;
  background: var(--grad-primary);
}
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }

/* =========================== Analyze / Upload =========================== */
.upload-zone {
  border: 2px dashed var(--accent); border-radius: var(--radius-lg); padding: 60px 30px;
  text-align: center; background: #fff; cursor: pointer; transition: all .2s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--bg-alt); }
.upload-zone .icon { font-size: 3rem; margin-bottom: 16px; }
.upload-preview { max-width: 320px; margin: 20px auto 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }

.score-gauge-wrap { display: flex; flex-direction: column; align-items: center; padding: 24px; }
.score-gauge { position: relative; width: 200px; height: 200px; }
.score-gauge svg { transform: rotate(-90deg); }
.score-gauge .bg { stroke: var(--border); }
.score-gauge .fg { stroke: url(#gaugeGradient); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.score-gauge .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-gauge .num .val { font-family: 'Cormorant Garamond', serif; font-size: 3rem; font-weight: 700; color: var(--primary); }
.score-gauge .num .grade { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

.concern-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; background: #fff; }
.concern-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.severity-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 10px 0; }
.severity-bar span { display: block; height: 100%; border-radius: 999px; }
.sev-1 { background: #7FD99E; width: 20%; }
.sev-2 { background: #B7DD7F; width: 40%; }
.sev-3 { background: var(--warning); width: 60%; }
.sev-4 { background: #E88A4D; width: 80%; }
.sev-5 { background: var(--danger); width: 100%; }
.ingredient-tag { display: inline-block; background: var(--bg-alt); color: var(--primary-dark); font-size: 0.78rem; padding: 4px 10px; border-radius: 999px; margin: 3px 4px 0 0; }

.routine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.routine-col { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.routine-col h4 { color: var(--primary); }
.routine-col ol { padding-left: 1.2em; }
.routine-col li { margin-bottom: 10px; }

.tab-nav { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 28px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 12px 18px; font-family: 'DM Sans', sans-serif; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-size: 0.95rem; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* =========================== Tables =========================== */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #F3ECF9; font-weight: 700; color: #4A2D6A; white-space: nowrap; font-size: 0.82rem; letter-spacing: .03em; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: .03em; }
.badge-free { background: #EEE; color: #666; }
.badge-basic { background: #E3E0FA; color: #4C3FA6; }
.badge-pro { background: var(--grad-primary); color: #fff; }
.badge-active { background: #E9F7EF; color: #256B44; }
.badge-pending { background: #FDF3D8; color: #96700D; }
.badge-denied { background: #FDECEC; color: #A02622; }
.badge-approved { background: #E9F7EF; color: #256B44; }
.badge-closed { background: #EEE; color: #666; }

/* =========================== Chat =========================== */
.chat-wrap { display: flex; flex-direction: column; height: 70vh; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.chat-bubble { max-width: 70%; padding: 12px 16px; border-radius: 16px; font-size: 0.94rem; }
.chat-bubble.me { align-self: flex-end; background: var(--grad-primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.them { align-self: flex-start; background: var(--bg-alt); color: var(--text); border-bottom-left-radius: 4px; }
.chat-time { font-size: 0.7rem; opacity: 0.7; margin-top: 4px; }
.chat-input-bar { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--border); }
.chat-input-bar input { flex: 1; }

/* =========================== Footer =========================== */
.site-footer { background: #130D1C; color: #d8c9e0; padding: 72px 0 28px; margin-top: 96px; }
.site-footer .brand { color: #fff; }
.footer-wrap { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.footer-col h4 { color: #fff; font-size: 1rem; margin-bottom: 16px; }
.footer-col a { display: block; color: #b8a3c4; font-size: 0.92rem; margin-bottom: 10px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; padding-top: 24px; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; color: #8a7595; }

/* =========================== Utilities =========================== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-0{margin-top:0} .mt-8{margin-top:8px} .mt-16{margin-top:16px} .mt-24{margin-top:24px} .mt-32{margin-top:32px} .mt-48{margin-top:48px}
.mb-0{margin-bottom:0} .mb-8{margin-bottom:8px} .mb-16{margin-bottom:16px} .mb-24{margin-bottom:24px}
.w-full { width: 100%; }
.rounded-img { border-radius: var(--radius); }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card-simple { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }

/* =========================================================
   RESPONSIVE
   Breakpoints: Tablet 768-1024, Mobile <767, Small Mobile <479
   ========================================================= */

/* === TABLET 768-1024 === */
@media (max-width: 1024px) {
  .container, .container-sm, .container-md { padding: 0 20px; }
  .section { padding: 64px 0; }
  .section-head { margin: 0 auto 40px; }

  .hero { padding: 56px 0 72px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-visual { max-width: 560px; margin: 0 auto; width: 100%; }
  .hero-sub { max-width: none; }

  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .steps .step::after { display: none; }
  .footer-wrap { grid-template-columns: 1fr 1fr; gap: 24px; }
  .routine-grid { grid-template-columns: 1fr; }
  .pricing-card.featured { transform: none; }

  /* Pricing: 2-per-row on tablet */
  #pricing .grid-3,
  .pricing-grid { grid-template-columns: 1fr 1fr; }

  /* Dermatologist cards: 2-per-row on tablet */
  .derm-grid, .grid-4.derm-list { grid-template-columns: 1fr 1fr; }

  /* Forms */
  .plan-select-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .plan-option { padding: 12px 8px; }

  /* Nav items: comfortable touch targets */
  .main-nav a, .main-nav .nav-avatar { min-height: 44px; display: inline-flex; align-items: center; }
}

/* === MOBILE 320-767 === */
@media (max-width: 767px) {
  .container, .container-sm, .container-md { padding: 0 16px; }
  .section { padding: 48px 0; }
  .section-head { margin: 0 auto 32px; }

  /* ---- Nav ---- */
  .nav-wrap { height: 68px; }
  .brand-logo { max-height: 44px !important; width: auto !important; height: auto !important; max-width: 160px !important; }
  .nav-toggle { display: flex; }
  .main-nav {
    position: absolute; top: 68px; left: 0; right: 0; background: #fff;
    flex-direction: column; align-items: stretch; padding: 12px 20px 24px; gap: 4px;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
    max-height: 0; overflow: hidden; opacity: 0;
    transform: translateY(-8px);
    transition: max-height .3s ease, opacity .25s ease, transform .25s ease, padding .3s ease;
    display: flex;
  }
  .nav-toggle-checkbox:checked ~ .main-nav {
    max-height: 600px; opacity: 1; transform: translateY(0); padding: 12px 20px 24px;
  }
  .main-nav a, .main-nav .btn { min-height: 44px; display: flex; align-items: center; width: 100%; box-sizing: border-box; }
  .main-nav .btn { justify-content: center; margin-top: 8px; }
  .main-nav .nav-avatar { width: 40px; height: 40px; margin: 4px 0; flex-shrink: 0; }
  .main-nav a.nav-link-muted { min-height: 44px; }

  /* ---- Hero ---- */
  .hero { padding: 40px 0 56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-visual { padding: 20px; max-width: 100%; overflow: hidden; }
  .hero-visual .score-ring-wrap { flex-wrap: wrap; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }
  .hero-trust { justify-content: center; text-align: center; gap: 20px; }
  .hero-trust div { flex: 1 1 40%; }

  /* ---- Feature / grids ---- */
  .grid-3, .grid-4, .grid-2, .steps { grid-template-columns: 1fr; }
  .card { padding: 24px; }
  .steps .step::after { display: none; }

  /* ---- Pricing ---- */
  #pricing .grid-3,
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-card.featured { transform: none; }
  .pricing-card { padding: 32px 24px; }

  /* ---- Dermatologist cards ---- */
  .derm-grid, .grid-4.derm-list { grid-template-columns: 1fr; }

  /* ---- Footer ---- */
  .footer-wrap { grid-template-columns: 1fr; gap: 16px; }
  .footer-col a { margin-bottom: 8px; }
  .site-footer { padding: 48px 0 24px; margin-top: 56px; }
  .footer-bottom { gap: 16px; }

  /* ---- Forms ---- */
  .form-page { padding: 32px 16px; }
  .form-card { padding: 32px 24px; }
  .form-row { grid-template-columns: 1fr; }
  .form-control { min-height: 48px; padding: 13px 16px; font-size: 1rem; }
  select.form-control { min-height: 48px; }
  .plan-select-grid { grid-template-columns: 1fr; gap: 10px; }
  .plan-option { padding: 14px 16px; text-align: left; display: flex; align-items: center; justify-content: space-between; min-height: 44px; }

  /* ---- Dashboard ---- */
  .dash-header { flex-direction: column; align-items: stretch; }
  .usage-widget { width: 100%; min-width: 0; box-sizing: border-box; }
  .analysis-grid { grid-template-columns: 1fr; }

  /* ---- Analyze ---- */
  .upload-zone { padding: 40px 20px; }
  .score-gauge-wrap { padding: 16px; }
  .score-gauge { width: 160px; height: 160px; }
  .score-gauge svg { width: 160px; height: 160px; }
  .score-gauge .num .val { font-size: 2.2rem; }
  .routine-grid { grid-template-columns: 1fr; }
  .concern-item { padding: 16px 18px; }

  .tab-nav {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; min-height: 44px; }

  /* ---- Chat ---- */
  .chat-wrap { height: calc(100vh - 140px); border-radius: var(--radius-sm); }
  .chat-bubble { max-width: 85%; }
  .chat-input-bar { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .chat-input-bar input { min-height: 44px; flex-basis: 100%; }
  .chat-input-bar .btn { min-height: 44px; }

  /* ---- Forum ---- */
  .thread-list .card-simple h3 { overflow-wrap: break-word; word-break: break-word; }
  .thread-list img, .forum-body img { max-width: 100%; height: auto; }

  /* ---- Tables ---- */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* ---- Buttons ---- */
  .btn { min-height: 44px; }
}

/* === SMALL MOBILE 320-479 === */
@media (max-width: 479px) {
  .form-card {
    margin: 0; width: 100%; max-width: 100%;
    border-radius: 0; border-left: none; border-right: none;
    padding: 28px 16px;
  }
  .form-page { padding: 0; align-items: flex-start; }
  .hero-trust div { flex: 1 1 100%; text-align: left; }
  .hero-trust { flex-direction: column; gap: 12px; align-items: flex-start; }
  h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
  .price-amount { font-size: 2.4rem; }
  .score-gauge { width: 140px; height: 140px; }
  .score-gauge svg { width: 140px; height: 140px; }
}
