:root {
  color-scheme: light;
  --ink: oklch(23% 0.018 345);
  --muted: oklch(45% 0.025 345);
  --quiet: oklch(69% 0.018 345);
  --paper: oklch(98.5% 0.004 20);
  --surface: oklch(96% 0.006 20);
  --line: oklch(86% 0.012 25);
  --beltran: #640031;
  --beltran-soft: oklch(95% 0.024 345);
  --beltran-ink: oklch(33% 0.13 345);
  --gold: oklch(76% 0.08 79);
  --danger: oklch(55% 0.17 29);
  --shadow: 0 16px 44px oklch(25% 0.04 345 / 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Poppins, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
select,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.beltran-header {
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  padding: 14px clamp(18px, 5vw, 72px);
  background: oklch(99% 0.002 20);
  border-bottom: 1px solid oklch(91% 0.01 25);
}

.beltran-logo {
  display: inline-flex;
  align-items: center;
}

.beltran-logo img {
  width: 58px;
  height: auto;
  display: block;
}

.beltran-nav {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 2.2vw, 30px);
}

.beltran-nav a,
.phone-link,
.diagnosis-link,
.beltran-footer a {
  color: var(--beltran);
  text-decoration: none;
}

.beltran-nav a {
  font-size: 0.9rem;
  font-weight: 400;
}

.beltran-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.phone-link {
  font-size: 0.94rem;
  font-weight: 600;
  white-space: nowrap;
}

.diagnosis-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--beltran);
  border-radius: 15px;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  white-space: nowrap;
}

.diagnosis-link:hover,
.ghost-button:hover,
.download-link:hover {
  background: var(--beltran);
  color: oklch(99% 0.002 20);
}

.app-shell {
  width: min(1320px, calc(100% - 32px));
  min-height: calc(100vh - 168px);
  margin: 34px auto;
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 26px;
}

.tool-panel,
.preview-stage {
  min-width: 0;
  background: oklch(99% 0.002 20);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.tool-panel {
  padding: clamp(22px, 3vw, 38px);
  display: flex;
  flex-direction: column;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--beltran);
  color: oklch(96% 0.02 80);
  flex: none;
}

.mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--beltran);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--beltran);
  font-size: clamp(1.65rem, 2.9vw, 2.35rem);
  font-weight: 200;
  line-height: 1.08;
}

h2 {
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  font-weight: 300;
  line-height: 1.18;
}

.intro-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 300;
  line-height: 1.65;
}

.experience-row {
  display: grid;
  gap: 2px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid oklch(88% 0.016 25);
  border-radius: 15px;
  background: oklch(98% 0.004 25);
  color: var(--beltran);
}

.experience-row strong {
  font-size: 1.02rem;
  font-weight: 600;
}

.experience-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 300;
}

.control-stack {
  display: grid;
  gap: 16px;
}

.drop-zone {
  min-height: 178px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 26px 20px;
  text-align: center;
  border: 1px dashed oklch(55% 0.11 345);
  border-radius: 15px;
  background: var(--beltran-soft);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease-out, border-color 160ms ease-out, background 160ms ease-out;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.is-over {
  outline: none;
  transform: translateY(-1px);
  border-color: var(--beltran);
  background: oklch(93% 0.032 345);
}

.drop-zone svg,
.ghost-button svg,
.primary-button svg,
.download-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-zone > svg {
  width: 42px;
  height: 42px;
  color: var(--beltran);
}

.drop-zone span {
  color: var(--beltran);
  font-weight: 600;
}

.drop-zone small,
.privacy-note,
.status-box span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ghost-button,
.primary-button,
.text-button,
.download-link {
  min-height: 46px;
  border-radius: 15px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-decoration: none;
  cursor: pointer;
}

.ghost-button {
  color: var(--beltran);
  background: oklch(99% 0.002 20);
  border-color: var(--beltran);
}

.primary-button {
  width: 100%;
  color: oklch(99% 0.002 20);
  background: var(--beltran);
  border-color: var(--beltran);
  font-weight: 500;
  text-transform: uppercase;
  box-shadow: 0 10px 24px oklch(34% 0.13 345 / 0.18);
}

.primary-button:hover:not(:disabled) {
  background: oklch(28% 0.12 345);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.primary-button.compact {
  min-height: 40px;
}

.text-button {
  background: transparent;
  color: var(--muted);
}

.camera-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--ink);
}

.camera-wrap video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.camera-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  background: oklch(99% 0.002 20);
}

.mode-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-group legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.mode-group label {
  position: relative;
}

.mode-group input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.mode-group span {
  min-height: 56px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(96% 0.008 84);
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}

.mode-group span strong {
  color: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

.mode-group span small {
  color: inherit;
  font-size: 0.72rem;
  font-weight: 300;
  line-height: 1.25;
}

.mode-group input:checked + span {
  border-color: var(--beltran);
  background: var(--beltran-soft);
  color: var(--beltran);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field-grid.is-hidden {
  display: none;
}

.color-picker {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.color-picker legend {
  grid-column: 1 / -1;
  color: var(--beltran);
  font-size: 0.86rem;
  font-weight: 500;
}

.color-picker label {
  position: relative;
}

.color-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.color-card {
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: oklch(99% 0.002 20);
  color: var(--muted);
  cursor: pointer;
}

.color-card i {
  width: 42px;
  height: 42px;
  grid-row: 1 / 3;
  border-radius: 999px;
  border: 1px solid oklch(70% 0.018 25);
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 0.34);
}

.color-card strong {
  color: var(--beltran);
  font-size: 1.05rem;
  font-weight: 600;
}

.color-card small {
  color: inherit;
  font-size: 0.72rem;
  font-weight: 300;
  line-height: 1.25;
}

.color-picker input:checked + .color-card {
  border-color: var(--beltran);
  background: var(--beltran-soft);
  color: var(--beltran);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--beltran);
  font-size: 0.86rem;
  font-weight: 500;
}

.field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: oklch(99% 0.002 20);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: oklch(99% 0.002 20);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.privacy-note {
  margin: 0;
}

.approx-note {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid oklch(86% 0.018 78);
  border-radius: 12px;
  background: oklch(97% 0.018 78);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 300;
  line-height: 1.45;
}

.preview-stage {
  padding: clamp(18px, 2.4vw, 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
}

.preview-topbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
}

.download-link {
  min-height: 42px;
  padding: 0 14px;
  color: var(--beltran);
  background: oklch(99% 0.002 20);
  border-color: var(--beltran);
  font-weight: 500;
  text-transform: uppercase;
}

.comparison {
  min-height: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.image-pane {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: oklch(95% 0.006 25);
}

.image-pane > span {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: oklch(99% 0.002 20 / 0.9);
  color: var(--beltran);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
}

.image-pane img,
.image-pane canvas {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: none;
  object-fit: contain;
  background: oklch(95% 0.006 25);
}

.image-pane.has-image img {
  display: block;
}

.empty-state {
  height: 100%;
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--quiet);
  text-align: center;
}

.empty-state svg {
  width: 88px;
  height: 88px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.status-box {
  min-height: 58px;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: oklch(98% 0.006 25);
}

.status-box strong {
  font-size: 0.92rem;
}

.status-box.is-error {
  border-color: oklch(70% 0.08 29);
  background: oklch(94% 0.035 29);
}

.status-box.is-working {
  border-color: oklch(56% 0.11 345);
  background: var(--beltran-soft);
}

body.is-busy .primary-button {
  pointer-events: none;
}

.loading-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: oklch(18% 0.04 345 / 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

.lead-modal {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: grid;
  place-items: center;
  padding: 22px;
  background: oklch(18% 0.04 345 / 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

.lead-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.lead-dialog {
  width: min(100%, 430px);
  display: grid;
  gap: 13px;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid oklch(91% 0.01 25);
  background: oklch(99% 0.002 20);
  color: var(--beltran);
  box-shadow: 0 24px 64px oklch(18% 0.04 345 / 0.28);
}

.lead-dialog strong {
  font-size: 1.14rem;
  font-weight: 500;
  line-height: 1.25;
}

.loading-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.loading-dialog {
  width: min(100%, 390px);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 24px 26px;
  border-radius: 20px;
  border: 1px solid oklch(91% 0.01 25);
  background: oklch(99% 0.002 20);
  color: var(--beltran);
  text-align: center;
  box-shadow: 0 24px 64px oklch(18% 0.04 345 / 0.28);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 3px solid var(--beltran-soft);
  border-top-color: var(--beltran);
  animation: loading-spin 900ms linear infinite;
}

.loading-kicker {
  margin: 6px 0 0;
  color: var(--beltran);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loading-dialog strong {
  font-size: 1.12rem;
  font-weight: 500;
}

.loading-dialog span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.55;
}

.extra-attempt-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.extra-attempt-toggle {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--beltran);
  border-radius: 999px;
  background: var(--beltran);
  color: oklch(99% 0.002 20);
  box-shadow: 0 12px 34px oklch(18% 0.04 345 / 0.24);
  cursor: pointer;
}

.extra-attempt-toggle svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.extra-attempt-panel {
  width: min(calc(100vw - 36px), 320px);
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: oklch(99% 0.002 20);
  box-shadow: 0 18px 44px oklch(18% 0.04 345 / 0.2);
}

.extra-attempt-panel[hidden] {
  display: none;
}

.extra-attempt-panel label {
  color: var(--beltran);
  font-size: 0.86rem;
  font-weight: 600;
}

.extra-attempt-panel div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.extra-attempt-panel input {
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.extra-attempt-panel button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--beltran);
  border-radius: 10px;
  background: var(--beltran);
  color: oklch(99% 0.002 20);
  font-weight: 600;
  cursor: pointer;
}

.extra-attempt-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 1.35;
}

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

.beltran-footer {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px clamp(18px, 5vw, 72px);
  color: oklch(99% 0.002 20);
  background: var(--beltran);
  font-size: 0.9rem;
  font-weight: 300;
  text-align: center;
}

.beltran-footer span:first-child {
  font-weight: 600;
}

.beltran-footer a {
  color: oklch(99% 0.002 20);
  text-decoration: underline;
}

@media (max-width: 980px) {
  .beltran-header {
    grid-template-columns: auto 1fr;
  }

  .beltran-nav {
    display: none;
  }

  .app-shell {
    width: min(100% - 24px, 720px);
    grid-template-columns: 1fr;
  }

  .comparison {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .image-pane img,
  .image-pane canvas,
  .empty-state {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .beltran-header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
  }

  .beltran-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .app-shell {
    width: 100%;
    min-height: auto;
    margin: 0;
    gap: 0;
  }

  .tool-panel,
  .preview-stage {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .field-grid,
  .camera-actions,
  .mode-group {
    grid-template-columns: 1fr;
  }

  .color-picker {
    grid-template-columns: 1fr;
  }

  .preview-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-link {
    width: 100%;
  }

  .beltran-footer {
    flex-direction: column;
    gap: 6px;
  }
}
