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

:root {
  --white: #FFFFFF;
  --bg: #000000;
  --bg-elevated: #0A0A0A;
  --card: #111111;
  --card-hover: #161616;
  --border: #1F1F1F;
  --border-light: #2A2A2A;
  --border-focus: #0D9488;
  --text: #E8E8E8;
  --text-secondary: #8A8A8A;
  --text-muted: #555555;
  --accent: #0D9488;
  --accent-light: #14B8A6;
  --accent-bg: rgba(13,148,136,0.10);
  --accent-bg2: rgba(13,148,136,0.18);
  --accent-dark: #0F766E;
  --accent-glow: rgba(13,148,136,0.25);
  --selected-tooth: #14B8A6;
  --selected-tooth-bg: rgba(13,148,136,0.15);
  --danger: #EF4444;
  --danger-bg: rgba(239,68,68,0.1);
  --warning: #F59E0B;
  --warning-bg: rgba(245,158,11,0.1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Progress Bar ── */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 3px; background: var(--card);
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

/* ── Header ── */
.app-header {
  position: fixed; top: 3px; left: 0; right: 0; z-index: 99;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo {
  height: 38px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.header-logo img { height: 30px; width: auto; display: block; }
.header-brand, .header-sub { display: none; }

/* Voyid Logo (dental arch icon) */
.voyid-logo-lg {
  display: flex; flex-direction: column; align-items: center; gap: 0; margin-bottom: 32px;
  padding: 8px 0;
}
.voyid-logo-lg img { height: 80px; width: auto; display: block; }
.voyid-logo-lg-text { display: none; }
.voyid-logo-lg-brand { font-weight: 800; font-size: 1.6rem; letter-spacing: 0.04em; }
.voyid-logo-lg-brand .gray { color: #5A5F66; }
.voyid-logo-lg-brand .teal { color: var(--accent); }
.voyid-logo-lg-sub { font-size: 0.82rem; color: var(--text-muted); font-weight: 400; letter-spacing: 0.12em; }
.header-step {
  font-size: 0.72rem; font-weight: 600; color: var(--accent);
  background: var(--accent-bg);
  padding: 4px 12px; border-radius: 20px;
  border: 1px solid rgba(13,148,136,0.2);
}

/* ── Back Button ── */
.back-btn {
  position: fixed; top: 58px; left: 12px; z-index: 98;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  opacity: 0; pointer-events: none;
}
.back-btn.visible { opacity: 1; pointer-events: auto; }
.back-btn:hover { background: var(--card-hover); }
.back-btn svg { width: 20px; height: 20px; color: var(--text); }

/* ── Container ── */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 70px 16px 40px;
  min-height: 100dvh;
}

/* ── Steps animation ── */
.step {
  display: none; opacity: 0; transform: translateY(16px);
}
.step.active {
  display: block;
  animation: fadeIn 0.35s cubic-bezier(0.4,0,0.2,1) forwards;
}
.step.exiting {
  display: block;
  animation: fadeOut 0.2s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(-8px); } }

/* ── Typography ── */
.step-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--white); }
.step-subtitle { font-size: 0.88rem; color: var(--text-secondary); margin-top: 6px; }
.section-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 10px; margin-top: 24px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition); width: 100%;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-bg); }
.btn-ghost { background: transparent; color: var(--text-secondary); font-weight: 500; }
.btn-whatsapp { background: #25D366; color: var(--white); }
.btn-whatsapp:hover { background: #20BD5A; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-row { display: flex; gap: 10px; margin-top: 24px; }
.btn-row .btn { flex: 1; }

/* ── Inputs ── */
.form-grid { display: grid; gap: 14px; margin-top: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-group { position: relative; }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.form-input, .form-select {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--border-light); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 1rem; color: var(--text);
  background: var(--card); transition: all var(--transition); outline: none;
  -webkit-appearance: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input.error { border-color: var(--danger); }
.form-select { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.form-error { font-size: 0.7rem; color: var(--danger); margin-top: 3px; display: none; }
.form-input.error ~ .form-error { display: block; }

/* ── Toggle Chips ── */
.chip-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chip {
  padding: 11px 20px; border-radius: 20px;
  border: 1.5px solid var(--border-light);
  background: var(--card); color: var(--text-secondary);
  font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); color: var(--white); border-color: var(--accent); }
.chip.selected { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* ── Odontogram ── */
.odontogram-wrapper {
  background: var(--card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 8px;
  margin-top: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.odontogram-label {
  text-align: center; font-size: 0.68rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.jaw-row {
  display: flex; justify-content: center; gap: 2px;
  margin: 3px 0;
}
.jaw-divider {
  height: 2px; background: var(--border-light);
  margin: 8px 0; border-radius: 1px;
}
.jaw-label-row {
  display: flex; justify-content: space-between; padding: 0 4px;
  font-size: 0.65rem; color: var(--text-muted); font-weight: 500;
}
.tooth {
  width: 36px; height: 44px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tooth:hover { background: var(--accent-bg); }
.tooth.selected { background: var(--selected-tooth-bg); }
.tooth-number {
  font-size: 0.65rem; font-weight: 700; color: var(--text-secondary);
  line-height: 1;
}
.tooth.selected .tooth-number { color: var(--selected-tooth); }
.tooth-shape {
  width: 18px; height: 22px; margin-top: 2px;
  fill: none; stroke: var(--text-muted); stroke-width: 1.5;
}
.tooth.selected .tooth-shape {
  stroke: var(--selected-tooth); fill: var(--selected-tooth-bg);
}
.tooth-dot {
  position: absolute; bottom: 1px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  opacity: 0; transition: opacity var(--transition);
}
.tooth.selected .tooth-dot { opacity: 1; }
.selected-teeth-display {
  margin-top: 12px; padding: 10px 14px;
  background: var(--accent-bg); border: 1px solid rgba(13,148,136,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem; color: var(--accent-light);
  display: none;
}
.selected-teeth-display.visible { display: block; }
.selected-teeth-display strong { font-weight: 700; }

/* ── Material / Work cards ── */
.option-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.option-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer; transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.option-card:hover { border-color: var(--accent); background: var(--card-hover); }
.option-card.selected { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 1px var(--accent), 0 0 20px var(--accent-glow); }
.option-radio {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border-light); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.option-card.selected .option-radio { border-color: var(--accent); background: var(--accent); }
.option-radio-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--white); opacity: 0; transition: opacity var(--transition); }
.option-card.selected .option-radio-dot { opacity: 1; }
.option-check {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border-light); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.option-card.selected .option-check { border-color: var(--accent); background: var(--accent); }
.option-check svg { width: 12px; height: 12px; color: var(--white); opacity: 0; }
.option-card.selected .option-check svg { opacity: 1; }
.option-info { flex: 1; }
.option-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.option-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.option-price { font-weight: 700; font-size: 0.88rem; color: var(--accent-light); white-space: nowrap; }

/* ── Color selector ── */
.color-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 12px;
}
.color-swatch {
  aspect-ratio: 1; border-radius: 8px;
  border: 2px solid var(--border-light);
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700;
  position: relative;
}
.color-swatch:hover { border-color: var(--accent); transform: scale(1.08); z-index: 1; }
.color-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); transform: scale(1.08); z-index: 1; }
.color-swatch.selected::after {
  content: ''; position: absolute;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); bottom: -3px;
}

/* ── Summary ── */
.summary-card {
  background: var(--card); border: 1.5px solid var(--border-light);
  border-radius: var(--radius); overflow: hidden; margin-top: 16px;
}
.summary-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--white); padding: 18px;
}
.summary-header-top { display: flex; justify-content: space-between; align-items: flex-start; }
.summary-folio { font-size: 0.72rem; font-weight: 500; opacity: 0.8; }
.summary-date { font-size: 0.72rem; font-weight: 500; opacity: 0.8; text-align: right; }
.summary-patient { font-size: 1.1rem; font-weight: 700; margin-top: 8px; }
.summary-doctor { font-size: 0.82rem; opacity: 0.85; margin-top: 2px; }
.summary-body { padding: 0; }
.summary-section { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.summary-section:last-child { border-bottom: none; }
.summary-section-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-light); margin-bottom: 8px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 0.85rem; }
.summary-row .label { color: var(--text-secondary); }
.summary-row .value { font-weight: 600; color: var(--text); }
.summary-total-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--accent-bg);
  border-top: 2px solid var(--accent);
}
.summary-total-bar .label { font-weight: 700; color: var(--accent-light); }
.summary-total-bar .value { font-weight: 800; font-size: 1.15rem; color: var(--accent-light); }
.summary-teeth-visual {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.summary-tooth-badge {
  background: var(--accent-bg2); color: var(--accent-light);
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.78rem; font-weight: 700;
}
.summary-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.summary-note {
  margin-top: 16px; padding: 12px; background: var(--card); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6;
}
.summary-note strong { color: var(--text); }

/* ── Email Button States ── */
.btn-email {
  background: var(--card); color: var(--accent-light);
  border: 1.5px solid var(--accent);
  position: relative; overflow: hidden;
}
.btn-email:hover { background: var(--accent-bg); }
.btn-email.sending {
  pointer-events: none; color: var(--text-muted);
  border-color: var(--border-light);
}
.btn-email.sent {
  background: var(--accent); color: var(--white);
  border-color: var(--accent); pointer-events: none;
}
.btn-email.error {
  border-color: var(--danger); color: var(--danger);
}
.btn-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.email-status {
  margin-top: 8px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 500;
  display: none;
}
.email-status.visible { display: flex; align-items: center; gap: 8px; }
.email-status.success { background: var(--accent-bg); color: var(--accent-light); border: 1px solid rgba(13,148,136,0.2); }
.email-status.error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.email-status svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .color-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 400px) {
  .step-title { font-size: 1.2rem; }
  .tooth { width: 30px; height: 38px; }
  .tooth-number { font-size: 0.58rem; }
  .tooth-shape { width: 15px; height: 18px; }
  .color-grid { grid-template-columns: repeat(5, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
}
@media (min-width: 601px) {
  .app-container { padding-top: 76px; }
}

/* Print styles */
@media print {
  :root { --card: #fff; --text: #111; --text-secondary: #555; --text-muted: #888; --border: #ddd; --border-light: #ddd; --bg: #fff; }
  body { background: white !important; color: #111 !important; }
  .progress-bar, .app-header, .back-btn, .btn-row, .summary-actions { display: none !important; }
  .app-container { padding: 0; max-width: 100%; }
  .step { display: block !important; opacity: 1 !important; transform: none !important; }
  .summary-card { border: 1px solid #ddd; box-shadow: none; }
  .summary-note { border: 1px solid #ddd; background: #f5f5f5; }
  .summary-row .value, .summary-total-bar .value, .summary-total-bar .label { color: #111 !important; }
}
