:root {
  --gold: #b97a12;
  --gold-light: #f5e7c8;
  --ink: #191919;
  --muted: #6d6b68;
  --line: #ded5c5;
  --paper: #ffffff;
  --page: #f4f1ea;
  --whatsapp: #118c4f;
  --shadow: 0 16px 42px rgba(41, 31, 15, .10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(185,122,18,.09), transparent 28rem),
    var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }

.app-header {
  min-height: 92px;
  padding: 14px max(20px, env(safe-area-inset-left));
  color: #fff;
  background: var(--ink);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}

.header-logo {
  width: 68px;
  height: 62px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 5px;
}

.eyebrow, .step {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .15em;
}

.app-header h1 { margin: 0; font-size: 24px; line-height: 1.1; }

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 28px auto 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, .82fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(185,122,18,.18);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-panel { padding: 24px; }
.preview-panel { padding: 24px; position: sticky; top: 20px; }

.section-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 { margin: 0; font-size: 21px; }

.text-button {
  border: 0;
  padding: 8px;
  color: var(--gold);
  background: transparent;
  font-weight: 750;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field { position: relative; margin-bottom: 16px; }
.field.full { width: 100%; }

label {
  display: block;
  margin: 0 0 7px;
  color: #3f3a32;
  font-size: 13px;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfc7ba;
  border-radius: 10px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185,122,18,.15);
}

input:invalid:not(:placeholder-shown) { border-color: #b13a32; }

small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.amount-field input { padding-left: 38px; }
.currency-prefix {
  position: absolute;
  left: 14px;
  bottom: 14px;
  color: var(--gold);
  font-weight: 800;
}

.optional-fields {
  margin: 4px 0 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf7;
}

.optional-fields summary {
  padding: 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.optional-fields summary span {
  color: var(--muted);
  font-weight: 500;
}

.optional-grid { padding: 0 14px; }

.form-error {
  padding: 11px 13px;
  color: #882f29;
  background: #fff0ef;
  border-radius: 9px;
  font-size: 13px;
}

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

.button {
  min-height: 50px;
  padding: 11px 15px;
  border: 0;
  border-radius: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .1s, filter .1s;
}

.button:active { transform: translateY(1px); }
.button:hover { filter: brightness(.96); }
.button-primary { color: #fff; background: var(--gold); }
.button-secondary { color: var(--ink); background: var(--gold-light); }
.button-whatsapp { grid-column: 1 / -1; color: #fff; background: var(--whatsapp); }
.button-whatsapp span { margin-right: 7px; }

.ticket-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #e8e4dc;
}

.ticket {
  width: 100%;
  aspect-ratio: 148 / 210;
  padding: 4.5% 4.2% 3.2%;
  background: var(--paper);
  border: 2px solid var(--gold);
  border-radius: 3.7%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: center;
}

.ticket-logo {
  width: 31%;
  max-height: 20%;
  margin: 0 auto 1.1%;
  object-fit: contain;
}

.ticket h3 { margin: 0; font-size: clamp(12px, 2.1vw, 17px); letter-spacing: .01em; }
.ticket .subtitle { margin: 1.1% 0 3%; color: var(--muted); font-size: clamp(7px, 1.15vw, 10px); }
.gold-rule { height: 1px; margin: 0 1.5% 3.5%; background: var(--gold); }

.route strong {
  display: block;
  font-size: clamp(13px, 2.3vw, 19px);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route span {
  display: block;
  margin-top: 1.6%;
  color: var(--muted);
  font-size: clamp(7px, 1.1vw, 10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route span b { font-weight: 500; }

.date-time-card {
  min-height: 14%;
  margin: 5% 0;
  background: var(--gold-light);
  border-radius: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.date-time-card > div { display: flex; flex-direction: column; justify-content: center; }
.date-time-card > div + div { border-left: 1px solid rgba(185,122,18,.42); }
.date-time-card span, .detail span, .fare-card span {
  color: var(--gold);
  font-size: clamp(6px, 1vw, 9px);
  font-weight: 850;
}
.date-time-card strong { margin-top: 5%; font-size: clamp(13px, 2.2vw, 19px); }

.details-card {
  flex: 1;
  min-height: 35%;
  padding: 4.2% 4.5%;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  column-gap: 5%;
  row-gap: 5%;
  text-align: left;
}

.detail {
  min-width: 0;
  padding-bottom: 4%;
  border-bottom: 1px solid var(--line);
}

.full-detail { grid-column: 1 / -1; }
.detail span, .detail strong { display: block; }
.detail strong {
  margin-top: 2%;
  font-size: clamp(8px, 1.5vw, 12px);
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fare-card {
  min-height: 9.5%;
  margin-top: 3.5%;
  padding: 0 4.5%;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.fare-card span { color: #f7ead0; }
.fare-card strong { font-size: clamp(16px, 2.7vw, 23px); white-space: nowrap; }

.ticket footer {
  margin-top: 2.5%;
  color: var(--muted);
  font-size: clamp(6px, .95vw, 8px);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}

.status-message {
  min-height: 20px;
  margin: 15px 0 0;
  color: #49643c;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.status-message.error { color: #a13730; }

.share-note {
  margin: 5px 3px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; max-width: 680px; }
  .preview-panel { position: static; }
  .ticket h3 { font-size: clamp(13px, 3.5vw, 20px); }
  .ticket .subtitle, .route span { font-size: clamp(8px, 2vw, 11px); }
  .route strong { font-size: clamp(15px, 4vw, 23px); }
  .date-time-card span, .detail span, .fare-card span { font-size: clamp(7px, 1.8vw, 10px); }
  .date-time-card strong { font-size: clamp(15px, 4vw, 22px); }
  .detail strong { font-size: clamp(9px, 2.7vw, 14px); }
  .fare-card strong { font-size: clamp(18px, 5vw, 28px); }
  .ticket footer { font-size: clamp(7px, 1.7vw, 10px); }
}

@media (max-width: 560px) {
  .app-header { min-height: 78px; }
  .header-logo { width: 56px; height: 51px; }
  .app-header h1 { font-size: 21px; }
  .app-shell { width: min(100% - 18px, 680px); margin-top: 14px; gap: 14px; }
  .panel, .form-panel, .preview-panel { padding: 17px; border-radius: 16px; }
  .form-grid { gap: 10px; }
  .field { margin-bottom: 13px; }
  .optional-grid { padding: 0 10px; }
  .actions { grid-template-columns: 1fr; }
  .button-whatsapp { grid-column: auto; }
  .ticket { border-width: 1.5px; }
}

@media print {
  body { background: #fff; }
  .app-header, .form-panel, .section-heading, .status-message, .share-note { display: none !important; }
  .app-shell, .preview-panel, .ticket-wrap, .ticket { margin: 0; padding: 0; width: 148mm; height: 210mm; border: 0; box-shadow: none; }
}
