:root {
  --blue: #0b6bf2; --blue-d: #0753c4; --blue-l: #e8f1ff; --orange: #ff6a00; --orange-d: #e65f00;
  --bg: #f2f5f9; --panel: #fff; --ink: #1b2533; --muted: #6b7a90; --line: #e1e7ef; --ok: #14a06f; --err: #e0353b;
  --radius: 14px; --shadow: 0 2px 10px rgba(16, 38, 74, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* header */
header { background: var(--blue); color: #fff; }
.bar { display: flex; align-items: center; gap: 22px; height: 58px; }
.brand { color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230b6bf2'%3E%3Cpath d='M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5z'/%3E%3C/svg%3E") center/18px no-repeat; }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav a { color: rgba(255, 255, 255, .85); padding: 7px 12px; border-radius: 9px; white-space: nowrap; }
nav a.on, nav a:hover { background: rgba(255, 255, 255, .16); color: #fff; }
button.link { background: none; border: 0; color: rgba(255, 255, 255, .85); cursor: pointer; padding: 6px; }

/* hero + search form */
.hero { background: linear-gradient(180deg, var(--blue) 0%, #2b84ff 100%); color: #fff; padding: 26px 0 34px; }
.hero h1 { font-size: 34px; line-height: 1.15; margin: 4px 0 18px; font-weight: 800; letter-spacing: -.5px; }
.tabs { display: inline-flex; background: rgba(255, 255, 255, .18); border-radius: 11px; padding: 3px; margin-bottom: 12px; }
.tabs button { border: 0; background: none; color: #fff; padding: 7px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.tabs button.on { background: #fff; color: var(--blue); }
.sform { display: grid; grid-template-columns: 1.15fr 1.15fr 1.25fr 1.25fr auto; gap: 2px; background: transparent; border-radius: var(--radius); }
.sform.oneway { grid-template-columns: 1.2fr 1.2fr 1.6fr auto; }
.sf { background: #fff; color: var(--ink); padding: 8px 14px; position: relative; min-height: 62px; display: flex; flex-direction: column; justify-content: center; }
.sf:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.sf label { font-size: 12px; color: var(--muted); }
.sf input { border: 0; outline: 0; padding: 2px 0; width: 100%; font-size: 16px; background: transparent; }
.sf .code { position: absolute; right: 14px; top: 26px; color: var(--muted); font-size: 13px; }
.sf .range { display: flex; align-items: center; gap: 4px; }
.sf .range input { font-size: 14px; min-width: 0; }
.sf .range span { color: var(--muted); }
.swap { position: absolute; right: -15px; top: 50%; transform: translateY(-50%); z-index: 2; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--blue); font-size: 15px; line-height: 1; }
.go { background: var(--orange); color: #fff; border: 0; padding: 0 28px; font-size: 17px; font-weight: 700; cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0; white-space: nowrap; }
.go:hover { background: var(--orange-d); }
.go:disabled { opacity: .7; cursor: default; }
.opts { display: flex; gap: 18px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.opts label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.sug { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); z-index: 20; overflow: hidden; margin-top: 4px; }
.sug div { padding: 9px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.sug div:hover, .sug div.on { background: var(--blue-l); }
.sug small { color: var(--muted); }

/* generic */
.page { padding: 22px 0 60px; }
.page h1 { font-size: 26px; margin: 0 0 16px; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.btn, button.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--blue-d); }
.btn.orange { background: var(--orange); } .btn.orange:hover { background: var(--orange-d); }
.btn.ghost { background: var(--blue-l); color: var(--blue); }
.btn.ghost:hover { background: #d7e7ff; }
.btn.danger { background: #fdecec; color: var(--err); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 13px; color: var(--muted); }
.field input, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; }
.field input:focus, .field select:focus { outline: 2px solid var(--blue-l); border-color: var(--blue); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; background: var(--blue-l); color: var(--blue); font-size: 12px; font-weight: 600; }
.chip.ok { background: #e3f6ee; color: var(--ok); } .chip.err { background: #fdecec; color: var(--err); } .chip.grey { background: #eef1f5; color: var(--muted); }
.err { color: var(--err); font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 12px; cursor: pointer; }
.seg button.on { background: var(--blue); color: #fff; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.t th { color: var(--muted); font-weight: 500; font-size: 13px; }

/* results */
.results { display: grid; grid-template-columns: 270px 1fr; gap: 18px; margin-top: 22px; }
.side .panel + .panel { margin-top: 14px; }
.big { font-size: 26px; font-weight: 800; }
.cal { display: flex; align-items: flex-end; gap: 2px; height: 110px; overflow-x: auto; padding-top: 18px; }
.cal .d { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; cursor: default; position: relative; }
.cal .d i { display: block; width: 100%; background: #b9d3fb; border-radius: 4px 4px 0 0; min-height: 4px; }
.cal .d.min i { background: var(--ok); }
.cal .d:hover i { background: var(--blue); }
.cal .d b { font-size: 9px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.ticket { display: grid; grid-template-columns: 190px 1fr; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ticket + .ticket { margin-top: 12px; }
.ticket .buy { padding: 16px; border-right: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.ticket .price { font-size: 24px; font-weight: 800; }
.ticket .legs { padding: 14px 18px; }
.leg { display: grid; grid-template-columns: 70px 1fr 70px; gap: 12px; align-items: center; }
.leg + .leg { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.leg .tm { font-size: 20px; font-weight: 700; }
.leg .dt { font-size: 12px; color: var(--muted); }
.leg .mid { text-align: center; font-size: 12px; color: var(--muted); }
.leg .line { height: 2px; background: var(--line); margin: 5px 0; position: relative; }
.leg .line::after { content: "✈"; position: absolute; right: -2px; top: -9px; color: var(--blue); font-size: 13px; }
.leg .tr { color: var(--orange); } .leg .dir { color: var(--ok); }
.al { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; }
.al img { width: 26px; height: 26px; border-radius: 6px; }

/* watches */
.wcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.wcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; border: 2px solid transparent; }
.wcard:hover { border-color: var(--blue-l); }
.wcard.off { opacity: .65; }
.wcard .rt { font-size: 18px; font-weight: 700; }
.wcard .nums { display: flex; gap: 18px; }
.wcard .nums div { display: flex; flex-direction: column; }
.wcard .nums b { font-size: 18px; }
.wcard .nums small { color: var(--muted); font-size: 12px; }
.hit b { color: var(--ok); }
svg.spark { width: 100%; height: 44px; display: block; }
svg.chart { width: 100%; height: 220px; display: block; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(10, 25, 50, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.mbox { background: #fff; border-radius: 18px; width: min(620px, 100%); padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.mbox h2 { margin: 0 0 14px; font-size: 21px; }

/* login */
.login { max-width: 380px; margin: 9vh auto; }
.login h1 { text-align: center; margin: 10px 0 18px; }
.login .logo { width: 52px; height: 52px; background-size: 32px; background-color: var(--blue-l); margin: 0 auto; display: block; border-radius: 14px; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, calc(100% - 32px)); }
.toast { background: #1b2533; color: #fff; padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow); font-size: 14px; }
.toast.err { background: var(--err); }

@media (max-width: 900px) {
  .sform, .sform.oneway { grid-template-columns: 1fr 1fr; gap: 2px; }
  .sf:first-child { border-radius: var(--radius) 0 0 0; }
  .sf:nth-child(2) { border-radius: 0 var(--radius) 0 0; }
  .go { grid-column: 1 / -1; border-radius: 0 0 var(--radius) var(--radius); padding: 14px; }
  .sform.oneway .sf:nth-child(3) { grid-column: 1 / -1; }
  .swap { right: -15px; }
  .results { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
}
@media (max-width: 600px) {
  .sform, .sform.oneway { grid-template-columns: 1fr; }
  .sf, .sf:first-child, .sf:nth-child(2) { border-radius: 0; }
  .sf:first-child { border-radius: var(--radius) var(--radius) 0 0; }
  .sform.oneway .sf:nth-child(3) { grid-column: auto; }
  .swap { right: 14px; top: auto; bottom: -15px; transform: rotate(90deg); }
  .ticket { grid-template-columns: 1fr; }
  .ticket .buy { border-right: 0; border-bottom: 1px dashed var(--line); flex-direction: row; align-items: center; justify-content: space-between; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .bar { gap: 10px; } .brand span + * { display: none; }
  .brand { font-size: 0; } .brand .logo { font-size: 0; }
  .wcards { grid-template-columns: 1fr; }
}
