/* ---------- App shell ---------- */
:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #5d6676;
  --accent: #2f6db5;
  --border: #d4d9e1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: #1f3a5f; color: #fff;
}
.app-bar h1 { margin: 0; font-size: 18px; }
.app-bar h1 span { font-weight: 400; font-size: 13px; opacity: .8; }
#downloadBtn {
  background: #f39c12; color: #fff; border: 0; border-radius: 6px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
}
#downloadBtn:disabled { opacity: .6; cursor: wait; }

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
}

.form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  position: sticky; top: 70px;
}
.form fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 12px; padding: 8px 10px 10px; }
.form legend { font-weight: 700; color: var(--accent); padding: 0 4px; }
.form label { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.form input, .form select {
  display: block; width: 100%; margin-top: 2px;
  padding: 6px 8px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 4px; color: var(--text);
}
.form .hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.preview-wrap { overflow-x: auto; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .form { position: static; max-height: none; }
}

/* ---------- Ticket (A4 at 96dpi = 794 x 1123 px) ---------- */
#ticket {
  width: 794px;
  margin: 0 auto;
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  color: #000;
}
.page {
  position: relative;
  width: 794px;
  height: 1122px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.page .frame {
  position: absolute; inset: 28px 28px 20px 28px;
  border-left: 1.5px solid #000; border-right: 1.5px solid #000;
  padding: 0 14px;
  font-size: 13.5px;
  line-height: 1.35;
}
.page-1 .frame { border-top: 1.5px solid #000; }
.page-2 .frame { bottom: auto; border-bottom: 1.5px solid #000; padding-bottom: 16px; }

.watermark {
  position: absolute; z-index: 5;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 54px; font-weight: 800; letter-spacing: 2px;
  color: rgba(200, 30, 30, .16);
  white-space: nowrap; pointer-events: none;
}

.b { font-weight: 700; }
.small { font-size: 12.5px; margin: 4px 0; }
.tiny { font-size: 10px; margin-top: 8px; }
.blue { color: #2f75b5; font-size: 18px; font-weight: 700; }
.sm { font-size: 12px; }

.ers-title { text-align: center; font-size: 16px; margin: 8px 0 0; }
.ers-title small { font-weight: 400; font-size: 12px; }

.logos { display: flex; justify-content: space-between; align-items: center; height: 92px; padding: 0 4px; }
.logo svg, .logo img { display: block; }

.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; }
.journey { font-size: 15.5px; padding-bottom: 4px; border-bottom: 1.5px solid #000; margin: 0 -14px; }
.journey .lbl { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.arrow {
  position: relative; display: inline-block; width: 210px;
  background: linear-gradient(#5b9bd5, #4a86c3); color: #e8f1fb;
  font-size: 15px; padding: 3px 0; margin-bottom: 6px;
}
.arrow::after {
  content: ""; position: absolute; right: -22px; top: -6px;
  border-left: 22px solid #4a86c3; border-top: 18px solid transparent; border-bottom: 18px solid transparent;
}
.train { row-gap: 2px; padding: 6px 0 4px; border-bottom: 1.5px solid #000; margin: 0 -14px; }
.train .lbl { font-weight: 700; font-size: 15px; }

.sec { font-size: 17px; margin: 6px 0 4px; display: inline-block; border-bottom: 1.5px solid #000; }
.sec-sm { font-size: 12px; text-decoration: underline; margin: 10px 0 4px; }

.pax { width: 100%; border-collapse: collapse; font-size: 14px; }
.pax th { text-align: left; font-size: 14.5px; padding: 2px 4px; }
.pax td { padding: 1px 4px; }
.pax th:nth-child(3), .pax td:nth-child(3),
.pax th:nth-child(4), .pax td:nth-child(4) { text-align: center; }

.acronyms {
  display: flex; justify-content: space-between;
  font-size: 7.5px; padding: 6px 0 6px; margin: 4px -14px 0; padding-left: 14px; padding-right: 14px;
  border-top: 1.5px solid #000;
}

.pay-qr { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 8px; }
.pay { flex: 1; font-size: 14px; }
.fare { border-collapse: collapse; font-size: 13px; }
.fare td { padding: 1px 4px; }
.fare td:first-child { width: 350px; }
.qr { width: 166px; height: 166px; margin: 18px 14px 0 0; }
.qr img, .qr canvas { width: 166px !important; height: 166px !important; }

.notes { margin: 28px 0 4px; padding-left: 14px; font-size: 12.5px; }
.notes.rule-top { margin: 4px -14px 0; padding: 4px 14px 0 28px; border-top: 1.5px solid #000; font-weight: 400; }

.gst { font-size: 12px; margin-top: 12px; }
.gst > div { margin: 4px 0; }
.g4 { display: grid; grid-template-columns: 150px 180px 165px 1fr; padding-left: 4px; }

.instructions { font-size: 10.4px; line-height: 1.3; padding-left: 18px; margin: 0; text-align: justify; }
.instructions li { padding-left: 4px; }
.rule-top { border-top: 1.5px solid #000; padding-top: 10px; margin-left: -14px; margin-right: -14px; padding-left: 14px; }
.care { font-size: 14px; padding-left: 26px; margin: 6px 0 16px; }

/* ---------- Banners ---------- */
.banner { margin: 0 -10px 16px; }
.banner img { display: block; width: 100%; height: auto; }

.banner-wallet { background: #0d3a6b; }
.bw-left { flex: 0 0 255px; }
.bw-line1 { font-size: 19px; font-weight: 800; }
.bw-line2 {
  font-size: 30px; font-weight: 900; color: #e74c3c;
  -webkit-text-stroke: 1.5px #fff; letter-spacing: 1px;
}
.bw-laptop { flex: 0 0 100px; }
.bw-laptop .screen { height: 62px; background: linear-gradient(135deg,#dfe8f3,#9db7d6); border: 4px solid #222; border-radius: 4px 4px 0 0; display: flex; align-items: center; justify-content: center; }
.bw-laptop .train-ico { font-size: 30px; }
.bw-laptop .base { height: 6px; background: #bbb; margin: 0 -8px; border-radius: 0 0 4px 4px; }
.bw-points { flex: 1; list-style: none; margin: 0; padding: 0; font-size: 11.5px; white-space: nowrap; }
.bw-points li { border-bottom: 1px dashed #c84; padding-left: 16px; position: relative; }
.bw-points li::before { content: "●"; position: absolute; left: 0; color: #f39c12; }

.banner-fraud { background: linear-gradient(90deg, #1a1446, #2a1a5e 60%, #1a1446); }
.bf-hood { font-size: 54px; }
.bf-title { display: flex; flex-direction: column; font-size: 20px; font-weight: 800; color: #ff5a5a; text-align: center; border-top: 1px solid #fff; border-bottom: 1px solid #fff; padding: 2px 10px; }
.bf-quote { flex: 1; font-size: 17px; font-weight: 800; text-align: center; }

/* While exporting: no shadows/gaps so pages render cleanly */
.exporting .page { box-shadow: none; margin-bottom: 0; }

.round-white-bg {
  background: #fff; border-radius: 50%;
}
.padding-10 {
  padding: 10px;
}
.logo-radial-effect {
  background: radial-gradient(
    ellipse at 48% 46%,
    #f1f0ed 0%,
    #d9d5dd 30%,
    #ada1b8 56%,
    #7b648d 80%,
    #513760 100%
  );
}
