:root {
  --bg: #f8f7fb;
  --surface: #ffffff;
  --surface-soft: #fbf8ff;
  --ink: #1f2430;
  --muted: #6f7280;
  --line: #e6e1eb;
  --brand: #b65ad7;
  --brand-dark: #8f35bd;
  --brand-soft: #f1e3f8;
  --medical: #2f8276;
  --warning: #a05a1a;
  --danger: #b3261e;
  --shadow: 0 18px 45px rgba(36, 28, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
}

.patient-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.top-panel,
.content-panel,
.doctor-panel,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.top-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px;
}

.brand-row,
.step-row,
.nav-row,
.button-row,
.doctor-top,
.card-top,
.summary-line,
.case-meta {
  display: flex;
  align-items: center;
}

.brand-row,
.doctor-top,
.card-top {
  justify-content: space-between;
  gap: 12px;
}

.brand-logo {
  width: 116px;
  height: auto;
  display: block;
}

.step-pill {
  border: 1px solid var(--brand-soft);
  background: var(--surface-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.step-row {
  margin-top: 12px;
  justify-content: space-between;
  gap: 12px;
}

.step-name {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.03;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.subtitle,
.help,
.muted {
  color: var(--muted);
}

.subtitle {
  margin-bottom: 18px;
  font-size: 15px;
  line-height: 1.55;
}

.help {
  font-size: 13px;
  line-height: 1.45;
}

.progress-wrap {
  flex: 1;
  height: 7px;
  background: #ede8f2;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--brand), var(--medical));
  border-radius: inherit;
  transition: width 180ms ease;
}

.content-panel {
  min-height: calc(100vh - 156px);
  padding: 18px;
}

.hero-illustration,
.photo-example {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbf8ff);
}

.hero-illustration {
  width: 68px;
  height: 68px;
  margin-bottom: 14px;
  border-radius: 8px;
}

.hero-illustration svg,
.photo-example svg {
  width: 44px;
  height: 44px;
}

.option-grid,
.field-stack,
.photo-grid,
.case-list,
.summary-stack,
.doctor-list {
  display: grid;
  gap: 10px;
}

.option-card,
.choice-chip,
.upload-card,
.summary-card,
.case-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.option-card {
  width: 100%;
  min-height: 108px;
  padding: 16px;
  text-align: left;
}

.option-card strong,
.upload-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 17px;
}

.option-card span,
.upload-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.option-card:hover,
.choice-chip.active,
.upload-card:hover,
.tab-button.active {
  border-color: rgba(182, 90, 215, 0.55);
  background: var(--surface-soft);
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #3c3d45;
  font-size: 13px;
  font-weight: 750;
}

.text-field,
.text-area,
.select-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}

.text-field,
.select-field {
  min-height: 52px;
  padding: 0 14px;
}

.text-area {
  min-height: 150px;
  padding: 13px 14px;
  resize: vertical;
}

.text-field:focus,
.text-area:focus,
.select-field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(182, 90, 215, 0.14);
}

.form-error {
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

.segmented,
.chip-grid,
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented .choice-chip {
  flex: 1 1 130px;
}

.choice-chip,
.tab-button {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 750;
}

.chip-grid .choice-chip {
  flex: 1 1 calc(50% - 8px);
}

.examples {
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.examples p {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 750;
}

.examples ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.photo-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.example-photo-grid {
  gap: 8px;
}

.photo-example {
  min-height: 132px;
  padding: 12px 8px;
  text-align: center;
}

.photo-example span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.sample-photo {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.94)),
    linear-gradient(135deg, #f6edf8, #edf8f5);
}

.sample-head {
  position: relative;
  width: 78px;
  height: 82px;
  margin: 0 auto;
}

.sample-face,
.sample-hair,
.sample-eye,
.sample-mouth,
.sample-mark {
  position: absolute;
  display: block;
}

.sample-hair {
  inset: 3px 13px 30px;
  border-radius: 999px 999px 28px 28px;
  background: #403044;
}

.sample-face {
  left: 17px;
  top: 15px;
  width: 44px;
  height: 54px;
  border: 2px solid rgba(143, 53, 189, 0.5);
  border-radius: 45% 45% 48% 48%;
  background: #f6d8c9;
  box-shadow: 0 10px 20px rgba(36, 28, 50, 0.08);
}

.sample-eye {
  top: 20px;
  width: 5px;
  height: 2px;
  border-radius: 999px;
  background: #574159;
}

.left-eye {
  left: 11px;
}

.right-eye {
  right: 11px;
}

.sample-mouth {
  left: 15px;
  top: 36px;
  width: 14px;
  height: 5px;
  border-bottom: 2px solid rgba(47, 130, 118, 0.85);
  border-radius: 0 0 999px 999px;
}

.sample-mark {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d05879;
  box-shadow: 9px 3px 0 rgba(208, 88, 121, 0.7);
}

.mark-one {
  left: 8px;
  top: 28px;
}

.mark-two {
  right: 9px;
  top: 31px;
}

.sample-left .sample-head,
.sample-right .sample-head {
  transform: rotateY(52deg);
}

.sample-right .sample-head {
  transform: rotateY(-52deg);
}

.sample-close .sample-head {
  transform: scale(1.34);
  transform-origin: center 24px;
}

.sample-close .sample-photo,
.sample-close {
  background:
    radial-gradient(circle at 58% 48%, rgba(208, 88, 121, 0.22), transparent 14px),
    linear-gradient(135deg, #f8effb, #f0faf7);
}

.photo-count {
  margin: 12px 0 0;
  color: var(--medical);
  font-size: 13px;
  font-weight: 800;
}

.real-example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.real-example-card {
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f1f7;
}

.real-example-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-example-grid {
  width: 100%;
  margin-bottom: 0;
}

.modal-example-grid .real-example-card {
  max-height: 260px;
}

.upload-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-card {
  min-height: 76px;
  padding: 14px;
  text-align: left;
}

.photo-preview-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.photo-preview {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f1f7;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove-button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.82);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(31, 36, 48, 0.22);
}

.photo-remove-button:focus-visible {
  outline: 3px solid rgba(182, 90, 215, 0.34);
  outline-offset: 2px;
}

.notice {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid #f0d9a7;
  border-radius: 8px;
  background: #fff9eb;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.45;
}

.error-box {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid #efb7b2;
  border-radius: 8px;
  background: #fff4f3;
  color: var(--danger);
  font-size: 13px;
}

.success-box {
  padding: 16px;
  border: 1px solid #b9ddd6;
  border-radius: 8px;
  background: #f1fbf9;
  color: #1e625a;
}

.summary-card,
.case-card {
  padding: 13px;
}

.summary-line {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.summary-line:last-child {
  border-bottom: 0;
}

.summary-line span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.summary-line span:last-child {
  text-align: right;
  font-weight: 750;
}

.nav-row {
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.button-row {
  gap: 8px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 50px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  border: 1px solid transparent;
}

.primary-button {
  flex: 1;
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: #ffffff;
  color: var(--brand-dark);
  border-color: var(--brand-soft);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.danger-button {
  background: #fff4f3;
  color: var(--danger);
  border-color: #efb7b2;
}

.full-width {
  width: 100%;
}

.loading {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 180px;
  color: var(--muted);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #ede8f2;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.loading h2 {
  margin: 0;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.doctor-shell {
  display: grid;
  gap: 14px;
}

.doctor-panel {
  padding: 16px;
}

.doctor-logo {
  width: 104px;
}

.tabs {
  margin: 14px 0;
}

.tab-button {
  flex: 1 1 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.case-card {
  display: grid;
  gap: 10px;
}

.case-id {
  color: var(--brand-dark);
  font-weight: 850;
}

.case-meta {
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-soft);
  color: #4b4453;
  font-size: 12px;
  font-weight: 750;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.thumb {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #f4f1f7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  background: rgba(31, 36, 48, 0.38);
  padding: 14px;
}

.modal-card {
  width: min(100%, 760px);
  max-height: 88vh;
  margin: 0 auto;
  overflow: auto;
  padding: 16px;
}

.modal-card .photo-preview-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.issue-backdrop {
  align-items: center;
  background: rgba(31, 36, 48, 0.48);
}

.issue-modal {
  display: grid;
  gap: 12px;
  text-align: center;
}

.issue-modal h2 {
  margin-bottom: 0;
}

.issue-modal p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.modal-icon svg {
  width: 38px;
  height: 38px;
}

.pending-preview {
  width: min(100%, 230px);
  margin: 2px auto;
}

.welcome-modal {
  display: grid;
  gap: 14px;
  text-align: center;
}

.welcome-modal h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.welcome-photo-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.welcome-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 28%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.process-flow {
  display: grid;
  gap: 0;
  text-align: left;
}

.process-step {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 68px;
}

.process-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 25px;
  top: 52px;
  bottom: -16px;
  width: 2px;
  background: linear-gradient(180deg, rgba(182, 90, 215, 0.6), rgba(47, 130, 118, 0.6));
}

.process-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.process-icon svg {
  width: 34px;
  height: 34px;
}

.process-step span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.photo-intro-modal {
  text-align: left;
}

.photo-intro-modal h2,
.photo-intro-modal p {
  text-align: center;
}

.camera-backdrop {
  align-items: center;
  background: rgba(31, 36, 48, 0.82);
}

.camera-card {
  padding: 12px;
  background: #0d1017;
  border-color: rgba(255, 255, 255, 0.16);
}

.camera-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: #05070b;
}

.camera-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-eye-cover {
  position: absolute;
  left: 23%;
  top: 32%;
  width: 54%;
  height: 7%;
  border-radius: 2px;
  background: #000000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.camera-actions {
  margin-top: 12px;
}

.whatsapp-card {
  background: linear-gradient(180deg, #ffffff, #fbf8ff);
}

.success-whatsapp {
  margin-top: 14px;
}

.success-whatsapp p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 28px;
  }

  .content-panel {
    padding: 24px;
  }

  .option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chip-grid .choice-chip {
    flex-basis: calc(33.333% - 8px);
  }

  .modal-backdrop {
    align-items: center;
  }
}
