:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --panel: #ffffff;
  --ink: #1b2630;
  --muted: #66727c;
  --line: #dde3e8;
  --accent: #1f6f78;
  --accent-dark: #15535a;
  --accent-soft: #e5f3f4;
  --good: #1d7a52;
  --good-soft: #e4f4ec;
  --warn: #b45309;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

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

.app-shell {
  width: min(880px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 120px;
}

/* HERO */
.hero {
  position: relative;
  display: grid;
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 18px;
  background: #172026;
  color: #fff;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  position: absolute; inset: 0; content: "";
  background: linear-gradient(90deg, rgba(12,20,27,.82), rgba(12,20,27,.42) 60%, rgba(12,20,27,.12));
}
.hero-content { position: relative; z-index: 1; align-self: end; max-width: 620px; padding: 26px; }
.lang-toggle {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
  background: rgba(255,255,255,.92); color: var(--ink);
  padding: 6px 12px 6px 8px; font-weight: 800; font-size: .82rem; cursor: pointer;
}
.lang-toggle:hover { background: #fff; }
.lang-toggle svg { display: block; }
.hero-content p:not(.eyebrow) { margin-top: 10px; color: rgba(255,255,255,.92); font-size: 1rem; line-height: 1.5; }
h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.04; }
h2 { font-size: 1.2rem; }
h3.subhead { margin: 26px 0 14px; font-size: 1rem; }

.eyebrow {
  margin-bottom: 6px; color: var(--accent);
  font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.hero .eyebrow { color: #cdf7fb; }

/* PROGRESS */
.progress {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-bottom: 16px; padding: 8px;
  background: rgba(244,246,247,.92); backdrop-filter: blur(10px);
  border-radius: var(--radius);
}
.progress-step {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  padding: 9px 6px; color: var(--muted); font-weight: 700; font-size: .82rem; cursor: pointer;
}
.progress-step span {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .78rem; font-weight: 800;
}
.progress-step.is-active { border-color: var(--accent); color: var(--accent-dark); }
.progress-step.is-active span { background: var(--accent); color: #fff; }
.progress-step.is-done span { background: var(--good); color: #fff; }
.progress-step .label-text { display: inline; }

/* PANELS */
.panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 22px; margin-bottom: 16px;
}
.panel.is-locked { opacity: .5; pointer-events: none; }
.panel.is-locked input, .panel.is-locked canvas { background: #f3f5f6; }
.section-heading { margin-bottom: 18px; }
.hint { margin-top: 8px; color: var(--muted); font-size: .92rem; line-height: 1.5; }

/* ROOM CARDS */
.room-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.room-card {
  position: relative; display: grid; gap: 6px; align-content: start;
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer;
}
.room-card input { position: absolute; opacity: 0; pointer-events: none; }
.room-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.room-name { font-weight: 800; font-size: 1.02rem; }
.room-price { font-size: 1.25rem; font-weight: 800; color: var(--accent-dark); }
.room-price small { display: block; margin-top: 2px; font-size: .78rem; font-weight: 600; color: var(--muted); }

/* UPLOADS */
.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.upload-box {
  position: relative; display: grid; gap: 6px; justify-items: center; text-align: center;
  min-height: 150px; align-content: center;
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer;
}
.upload-box input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 1.4rem; font-weight: 700;
}
.upload-title { font-weight: 800; }
.upload-state { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.upload-box.is-filled { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.upload-box.is-filled .upload-icon { background: var(--good); color: #fff; }
.upload-box.is-filled .upload-state { color: var(--good); font-weight: 700; }

.whatsapp-field { display: grid; gap: 10px; }
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid #25d36633; border-left: 4px solid #25d366; border-radius: var(--radius);
  background: #25d3660f; padding: 12px 14px; margin: 0;
}
.callout-icon {
  flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 999px; background: #25d366; color: #fff;
}
.callout strong { display: block; margin-bottom: 4px; font-size: .94rem; }
.callout p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }

.ocr-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent-soft); padding: 12px 14px; color: var(--accent-dark); font-weight: 700; font-size: .92rem;
}
.spinner {
  width: 16px; height: 16px; flex: 0 0 16px; border-radius: 999px;
  border: 2px solid rgba(31,111,120,.3); border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* FIELDS */
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: grid; }
.field.wide { grid-column: 1 / -1; }
.field-label { color: #344054; font-size: .88rem; font-weight: 750; margin-bottom: 6px; }
.field-label em { font-style: normal; color: var(--warn); font-weight: 700; font-size: .8rem; }
.from-doc-badge {
  display: inline-block; border-radius: 999px; background: var(--good-soft); color: var(--good);
  padding: 1px 8px; font-size: .72rem; font-weight: 800; vertical-align: middle;
}
.field.is-auto .field-label::after {
  content: var(--from-doc-label, "from passport"); margin-left: 6px;
  display: inline-block; border-radius: 999px; background: var(--good-soft); color: var(--good);
  padding: 1px 8px; font-size: .68rem; font-weight: 800;
}

input { font: inherit; }
input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%; border: 1px solid #cbd5df; border-radius: 10px; background: #fff;
  padding: 12px; color: var(--ink);
}
input:focus { outline: 3px solid rgba(31,111,120,.18); border-color: var(--accent); }
.field.is-auto input { border-color: var(--good); background: var(--good-soft); }
.field.invalid input { border-color: var(--warn); outline: 3px solid rgba(180,83,9,.15); }

/* CONTRACT */
.contract-document {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fffdfa; padding: 22px; margin-bottom: 18px;
}
.contract-document header { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; }
.contract-body { display: grid; gap: 18px; }
.contract-table { width: 100%; border-collapse: collapse; }
.contract-table th, .contract-table td {
  border-bottom: 1px solid var(--line); padding: 9px 0; text-align: left; vertical-align: top; font-size: .94rem;
}
.contract-table th { width: 42%; color: var(--muted); font-weight: 700; }
.terms-list { margin: 0; padding-left: 18px; line-height: 1.55; font-size: .92rem; }
.terms-list li { margin-bottom: 8px; }
.contract-date { color: var(--muted); font-size: .88rem; }
.contract-intro { font-size: .98rem; line-height: 1.6; }
.contract-contacts { margin-top: 4px; }
.contract-sign-line { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 16px; }
.contract-sign-line > span { color: var(--muted); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.sign-slot { min-height: 60px; border-bottom: 1.5px solid #15293a; display: flex; align-items: flex-end; }
.sign-slot img { max-height: 90px; max-width: 100%; }

/* AGREEMENT + SIGN */
.agreement { display: grid; gap: 4px; margin-bottom: 22px; }
.checkbox-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; line-height: 1.45; font-size: .94rem; cursor: pointer; }
.checkbox-row input { margin-top: 2px; width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--accent); }

.sign-section { display: grid; gap: 16px; }
.sign-upload-row { display: grid; gap: 6px; }
.sign-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; }
.sign-divider::before, .sign-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sign-offline { display: grid; gap: 12px; justify-items: start; }
.sign-offline #downloadContract:disabled { opacity: .6; cursor: progress; }
.contract-sign-line > strong { font-size: 1rem; }
.sign-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.sign-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.signature-pad {
  width: 100%; height: 180px; border: 1.5px dashed var(--line); border-radius: 10px;
  background: #fcfdfd; touch-action: none; cursor: crosshair; display: block;
}
.signature-pad.has-ink { border-style: solid; border-color: var(--good); }
.sign-meta { margin-top: 8px; color: var(--muted); font-size: .82rem; }
.sign-meta.is-done { color: var(--good); font-weight: 700; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; font-size: .88rem; }

/* ACTIONS */
.actions {
  position: sticky; bottom: 12px; display: flex; gap: 12px; justify-content: flex-end;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px); padding: 12px;
}
button { font: inherit; border: 0; border-radius: 10px; padding: 13px 20px; font-weight: 800; cursor: pointer; }
#submitButton { background: var(--accent); color: #fff; }
#submitButton:hover { background: var(--accent-dark); }
#submitButton:disabled { opacity: .55; cursor: progress; }
button.ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); }
button.ghost:hover { border-color: var(--accent); background: var(--accent-soft); }

/* RESULT */
.result-panel {
  text-align: center; border: 1px solid var(--good); border-radius: var(--radius);
  background: var(--good-soft); padding: 40px 24px;
}
.result-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 999px; background: var(--good); color: #fff; font-size: 1.8rem; font-weight: 800;
}
.result-panel h2 { margin-bottom: 8px; }
.result-panel p { color: var(--muted); line-height: 1.5; margin-bottom: 20px; }

/* RESPONSIVE */
@media (max-width: 720px) {
  .room-grid, .upload-grid, .field-grid { grid-template-columns: 1fr; }
  .progress-step .label-text { display: none; }
  .progress-step { padding: 9px 4px; }
  .hero { min-height: 200px; }
  .actions { flex-direction: column-reverse; }
  .actions button { width: 100%; }
}
