:root {
  --bg: #f4f2ef; --card: #ffffff; --ink: #1c1b22; --muted: #6b6875; --line: #e3dfd9;
  --accent: #5b2a86; --accent-ink: #fff; --accent-soft: #efe7f6;
  --good: #13795b; --good-soft: #e3f4ec; --bad: #b42318; --bad-soft: #fdecea; --warn-soft: #fff4d6;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,16,30,.06), 0 4px 16px rgba(20,16,30,.05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
/* Theme (v1.18, setting ui_theme): no data-theme = follow the device; data-theme="light"|"dark" forces one.
   Every dark rule below appears twice: inside the media query (unless forced light) and for forced dark. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #131218; --card: #1d1b24; --ink: #ecebf0; --muted: #9a97a6; --line: #2e2b38;
    --accent: #b48ce0; --accent-ink: #14121a; --accent-soft: #2b2338; --good: #4cc79a; --good-soft: #15302a;
    --bad: #f2827a; --bad-soft: #3a1f1f; --warn-soft: #3a3220; --shadow: none; }
}
:root[data-theme="dark"] { --bg: #131218; --card: #1d1b24; --ink: #ecebf0; --muted: #9a97a6; --line: #2e2b38;
    --accent: #b48ce0; --accent-ink: #14121a; --accent-soft: #2b2338; --good: #4cc79a; --good-soft: #15302a;
    --bad: #f2827a; --bad-soft: #3a1f1f; --warn-soft: #3a3220; --shadow: none; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
pre { white-space: pre-wrap; background: var(--bg); padding: .75rem; border-radius: 8px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.logo { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .95rem; margin-right: .3rem; }
nav { display: flex; align-items: center; gap: .25rem; }
nav a, .linkish { color: var(--muted); text-decoration: none; padding: .4rem .7rem; border-radius: 8px; font: inherit;
  background: none; border: 0; cursor: pointer; }
nav a:hover, .linkish:hover { background: var(--bg); color: var(--ink); }
nav a.active { color: var(--ink); background: var(--accent-soft); }
nav { margin-left: auto; flex-wrap: wrap; }

/* profile icon and its drop-down menu (top right) */
.avatar { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.md { width: 2.6rem; height: 2.6rem; font-size: 1rem; }
.avatar.xl { width: 6rem; height: 6rem; font-size: 2rem; }
.profile-menu { position: relative; }
.profile-menu > summary { list-style: none; cursor: pointer; border: 2px solid transparent; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-menu > summary:hover, .profile-menu[open] > summary { border-color: var(--accent); }
.profile-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-menu .menu { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 14rem; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem;
  box-shadow: 0 8px 28px rgba(20,16,30,.16); }
.profile-menu .menu-head { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem .7rem;
  border-bottom: 1px solid var(--line); margin-bottom: .3rem; overflow-wrap: anywhere; }
.profile-menu .menu a, .profile-menu .menu button { display: block; width: 100%; text-align: left; padding: .5rem .7rem;
  border-radius: 8px; color: var(--ink); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; }
.profile-menu .menu a:hover, .profile-menu .menu button:hover, .profile-menu .menu a.active { background: var(--accent-soft); }
.profile-menu .menu form { margin: 0; }
.picture-row { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.picture-row > div { flex: 1 1 18rem; }
button.avatar.zoomable { padding: 0; border: 2px solid transparent; cursor: zoom-in; }
button.avatar.zoomable:hover { border-color: var(--accent); }
button.avatar.zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 92vw; max-height: 92vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 8, 16, .82); }
.lightbox img { display: block; max-width: 92vw; max-height: 92vh; width: auto; height: auto; border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5); cursor: zoom-out; background: var(--card); }
.lightbox-close { position: fixed; top: .8rem; right: .8rem; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.92); color: #1c1b22; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.actions.end { justify-content: flex-end; margin-top: .75rem; }
@media (max-width: 760px) {
  .top-actions { order: 2; margin-left: auto; }
  nav { order: 3; width: 100%; margin-left: 0; }
}

.banner { padding: .6rem 1.25rem; text-align: center; font-size: .92rem; }
.banner.warn { background: var(--warn-soft); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 1rem 2rem; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.actions, .btns { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.inline { display: inline; margin: 0; }
.hidden { display: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card.empty { text-align: center; padding: 2.5rem 1.25rem; }
.card.empty p { max-width: 540px; margin: .5rem auto 1.25rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.grid .card { margin: 0; display: flex; flex-direction: column; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }

.btn { display: inline-flex; align-items: center; gap: .3rem; padding: .5rem .95rem; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 550; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.wide { width: 100%; justify-content: center; margin-top: .75rem; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.deal { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.error { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.flash { padding: .7rem 1rem; border-radius: 9px; margin-bottom: 1rem; background: var(--accent-soft); }
.flash.ok { background: var(--good-soft); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.errorbox { background: var(--bad-soft); color: var(--bad); padding: .5rem .7rem; border-radius: 8px; }
.err { color: var(--bad); }

.trip-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.trip-head h2 { margin: 0; }
.trip-head h2 a { color: var(--ink); text-decoration: none; }
.trip.paused { opacity: .6; }
.trip.status-deal { border-color: var(--good); }
.trip.has-voucher:not(.status-deal) { border-color: var(--accent); }
.best.voucher { display: block; background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.best.voucher:hover { outline: 1px solid var(--accent); }
.badges { display: inline-flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.route { font-weight: 650; font-size: 1.05rem; margin: .35rem 0 .6rem; letter-spacing: .02em; }
.route.big { font-size: 1.2rem; margin: .2rem 0; }
.arrow { color: var(--accent); padding: 0 .2rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0 0 .8rem; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.flex { color: var(--accent); font-weight: 600; font-size: .85em; }
.best { background: var(--bg); border-radius: 9px; padding: .6rem .75rem; margin-bottom: .8rem; }
.best.deal { background: var(--good-soft); }
.best .label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.trip-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.notes { background: var(--bg); padding: .5rem .75rem; border-radius: 8px; max-width: 700px; }

.form fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
.form legend { font-weight: 700; font-size: 1.05rem; margin-bottom: .6rem; padding: 0; }
.row { display: flex; gap: .9rem 1.1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .75rem; }
.row > label, .row > .field { flex: 1 1 180px; }
.row > label.check, .row > label.radio { flex: 0 0 auto; }
.grow { flex: 2 1 240px !important; }
label { display: block; font-weight: 550; font-size: .9rem; }
label small { display: block; font-weight: 400; color: var(--muted); margin-top: .2rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font: inherit; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input.codes { text-transform: uppercase; letter-spacing: .05em; }
label.check, label.radio { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; padding: .45rem 0; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
.hint { color: var(--muted); font-size: .86rem; margin: .25rem 0 0; max-width: 820px; }
.hint.full { max-width: none; }
.formfoot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 1rem; }
.formfoot.sticky { position: sticky; bottom: 0; background: var(--bg); padding: .8rem 0; border: 0; justify-content: flex-end; margin-bottom: 1.25rem; }
.danger-zone { text-align: right; }
.login { max-width: 380px; margin: 4rem auto; }
.login h1 { font-size: 1.3rem; margin-bottom: 1rem; }

.channel { border-top: 1px solid var(--line); padding: 1rem 0 .4rem; }
.channel-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }
.channel-head h3 { flex: 1; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; white-space: nowrap; }
table.compact td { padding: .3rem .5rem; }
table.avail { width: auto; min-width: 60%; }
table.avail td { min-width: 150px; }
table.avail td.date { min-width: 120px; white-space: nowrap; font-weight: 550; }
table.avail td strong { display: block; font-size: 1rem; }
table.avail .tax { display: block; color: var(--muted); font-size: .84rem; }
table.avail .meta { display: block; color: var(--muted); font-size: .76rem; }
table.avail td.none { color: var(--line); }
table.avail td.hit, .swatch.hit { background: var(--good-soft); }
table.avail td.hit strong { color: var(--good); }
.swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; vertical-align: -2px; border: 1px solid var(--good); }
.dealcard { border-color: var(--good); }
.cheapest { margin: .25rem 0 0; padding-left: 1.2rem; }
.cheapest li { margin: .2rem 0; }
.spark { width: 100%; height: 60px; color: var(--accent); }
details.alert { border-bottom: 1px solid var(--line); padding: .55rem 0; }
details.alert summary { cursor: pointer; }
details.alert { scroll-margin-top: 5rem; }
details.alert:target > summary { background: var(--accent-soft); border-radius: 6px; box-shadow: 0 0 0 .35rem var(--accent-soft); }
.alerts-mini { list-style: none; padding: 0; margin: 0 0 .75rem; }
.alerts-mini li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 600px) { .wrap { padding: 1rem .8rem 2rem; } .topbar { padding: .6rem .8rem; } }
h3.sub { margin: 1.1rem 0 .5rem; font-size: .95rem; }
.tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: 0 .35rem; border-radius: 4px; background: var(--bg); color: var(--muted); }
.tag.saver { background: var(--good-soft); color: var(--good); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.facts.wide { grid-template-columns: 9rem 1fr; }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.task-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.task.task-done { border-color: var(--good); }
.task.task-error, .task.task-stale { border-color: var(--bad); }
.task pre, pre.logs { max-height: 360px; overflow: auto; font-size: .78rem; margin-top: .6rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input[type=file] { padding: .4rem; }
.busy-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(2px); animation: fadein .15s ease-out; }
.busy-overlay[hidden] { display: none; }
.busy-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 40px rgba(20,16,30,.18);
  padding: 1.6rem 2rem; text-align: center; max-width: 420px; margin: 1rem; }
.busy-msg { font-weight: 600; font-size: 1.05rem; margin: .9rem 0 .3rem; }
.spinner.big { width: 2.4rem; height: 2.4rem; border-width: 3px; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.banner.info { background: var(--accent-soft); display: flex; align-items: center; justify-content: center; gap: .6rem; }
.card.checking { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--accent-soft); border-color: transparent; }
.badge.voucher { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.vouchercard { border-color: var(--accent); }
tr.covered td { background: color-mix(in srgb, var(--good-soft) 60%, transparent); }
.good { color: var(--good); }
.field > small { display: block; margin-top: .1rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
tr.dim td { opacity: .55; }
.rate { display: inline-block; font-weight: 650; font-size: .82rem; padding: .05rem .4rem; border-radius: 5px; background: var(--bg); }
.rate.great { background: var(--good-soft); color: var(--good); }
.rate.good { background: var(--accent-soft); color: var(--accent); }
.rate.poor { background: var(--bad-soft); color: var(--bad); }
.best .rate { margin-left: .3rem; }
.voucher-list { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .9rem; }
.vchip { border: 1px solid var(--line); border-radius: 8px; padding: .3rem .6rem; font-size: .84rem; background: var(--card); }
.vchip.covers { border-color: var(--good); background: var(--good-soft); }
.vchip.no { opacity: .6; }
.tag.record { background: #fff2cc; color: #8a5a00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.record { background: #3a3014; color: #f0c55a; }
}
:root[data-theme="dark"] .tag.record { background: #3a3014; color: #f0c55a; }
/* price history chart — reference palette slots 1-3, validated light & dark */
.viz-root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --grid: #ebe8e3; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .viz-root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --grid: #2e2b38; }
}
:root[data-theme="dark"] .viz-root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --grid: #2e2b38; }
.chart-wrap { position: relative; }
.hist { width: 100%; height: auto; display: block; overflow: visible; }
.hist .grid { stroke: var(--grid); stroke-width: 1; }
.hist .ax { fill: var(--muted); font-size: 11px; }
.hist .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hist .dot { stroke: var(--card); stroke-width: 2; }
.hist .endlab { fill: var(--ink); font-size: 11px; font-weight: 600; }
.hist .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.hist .s1 { stroke: var(--series-1); } .hist .dot.s1 { fill: var(--series-1); }
.hist .s2 { stroke: var(--series-2); } .hist .dot.s2 { fill: var(--series-2); }
.hist .s3 { stroke: var(--series-3); } .hist .dot.s3 { fill: var(--series-3); }
.hist .dot { stroke: var(--card); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; font-size: .85rem; margin: .2rem 0 .4rem; }
.lg { display: inline-flex; align-items: center; gap: .35rem; }
.sw { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.sw.s1 { background: var(--series-1); } .sw.s2 { background: var(--series-2); } .sw.s3 { background: var(--series-3); }
.tip { position: absolute; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem;
  font-size: .82rem; box-shadow: 0 4px 16px rgba(20,16,30,.15); pointer-events: none; min-width: 190px; }
.progress { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; margin: .5rem 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .4s; }
#scan-status.hidden { display: none; }

/* sortable, filterable tables (static/tables.js, opt in with <table data-table>) */
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; font-weight: inherit; color: inherit; }
th.num .th-sort { flex-direction: row-reverse; }
.th-sort:hover { color: var(--ink); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sort-ind { display: inline-block; width: .7em; opacity: .35; font-size: .8em; }
.sort-ind::after { content: "↕"; }
th[aria-sort="ascending"] .sort-ind, th[aria-sort="descending"] .sort-ind { opacity: 1; color: var(--accent); }
th[aria-sort="ascending"] .sort-ind::after { content: "▲"; }
th[aria-sort="descending"] .sort-ind::after { content: "▼"; }
.filter-row td { padding: .3rem .35rem .5rem; border-bottom: 1px solid var(--line); background: var(--card); }
.filter-row input, .filter-row select { margin: 0; padding: .3rem .45rem; font-size: .82rem; min-width: 5.5rem; width: 100%; }
.table-status { margin: .5rem 0 0; }

/* Communications log detail (v1.16): the email as sent, in a sandboxed frame */
.email-preview { width: 100%; height: 75vh; min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #f4f2ef; }
table.kv th { text-align: left; width: 7rem; color: var(--muted); font-weight: 500; }


/* ---------- Page background (v1.17, Account → Appearance; setting ui_background) ----------
   plain = the original flat background. sky = soft glows. routes = sky + faint flight paths.
   Everything is inline (no image files or requests). Cards keep their own solid background. */
:root {
  --glow-a: rgba(91, 42, 134, .13); --glow-b: rgba(232, 150, 110, .14); --glow-c: rgba(70, 140, 200, .08);
  --routes: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 1600 1000%22 preserveAspectRatio=%22xMidYMid slice%22%3E%3Cpath d=%22M-40 820 Q 520 260 1180 520%22 fill=%22none%22 stroke=%22%235b2a86%22 stroke-opacity=%220.11%22 stroke-width=%222%22 stroke-dasharray=%228 10%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M120 1040 Q 760 380 1660 300%22 fill=%22none%22 stroke=%22%235b2a86%22 stroke-opacity=%220.11%22 stroke-width=%222%22 stroke-dasharray=%226 12%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M-60 300 Q 640 -60 1500 120%22 fill=%22none%22 stroke=%22%235b2a86%22 stroke-opacity=%220.11%22 stroke-width=%222%22 stroke-dasharray=%224 12%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M300 1060 Q 980 640 1680 860%22 fill=%22none%22 stroke=%22%235b2a86%22 stroke-opacity=%220.11%22 stroke-width=%222%22 stroke-dasharray=%228 14%22 stroke-linecap=%22round%22/%3E%3Ccircle cx=%221180%22 cy=%22520%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Ccircle cx=%221660%22 cy=%22300%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Ccircle cx=%221500%22 cy=%22120%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Ccircle cx=%221680%22 cy=%22860%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Ccircle cx=%22-40%22 cy=%22820%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Ccircle cx=%22120%22 cy=%221040%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Ccircle cx=%22300%22 cy=%221060%22 r=%225%22 fill=%22%235b2a86%22 fill-opacity=%220.18%22/%3E%3Cg transform=%22translate%281012 487%29 rotate%28-24%29 scale%281.6%29%22 fill=%22%235b2a86%22 fill-opacity=%220.22%22%3E%3Cpath d=%22M0 -2 L9 -2 L14 0 L9 2 L0 2 L-5 7 L-8 7 L-5 2 L-10 2 L-12 4 L-14 4 L-12 0 L-14 -4 L-12 -4 L-10 -2 L-5 -2 L-8 -7 L-5 -7 Z%22/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --glow-a: rgba(180, 140, 224, .14); --glow-b: rgba(232, 150, 110, .07); --glow-c: rgba(90, 160, 230, .07);
    --routes: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 1600 1000%22 preserveAspectRatio=%22xMidYMid slice%22%3E%3Cpath d=%22M-40 820 Q 520 260 1180 520%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%228 10%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M120 1040 Q 760 380 1660 300%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%226 12%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M-60 300 Q 640 -60 1500 120%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%224 12%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M300 1060 Q 980 640 1680 860%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%228 14%22 stroke-linecap=%22round%22/%3E%3Ccircle cx=%221180%22 cy=%22520%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%221660%22 cy=%22300%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%221500%22 cy=%22120%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%221680%22 cy=%22860%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%22-40%22 cy=%22820%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%22120%22 cy=%221040%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%22300%22 cy=%221060%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Cg transform=%22translate%281012 487%29 rotate%28-24%29 scale%281.6%29%22 fill=%22%23c9a8f0%22 fill-opacity=%220.26%22%3E%3Cpath d=%22M0 -2 L9 -2 L14 0 L9 2 L0 2 L-5 7 L-8 7 L-5 2 L-10 2 L-12 4 L-14 4 L-12 0 L-14 -4 L-12 -4 L-10 -2 L-5 -2 L-8 -7 L-5 -7 Z%22/%3E%3C/g%3E%3C/svg%3E"); }
}
:root[data-theme="dark"] { --glow-a: rgba(180, 140, 224, .14); --glow-b: rgba(232, 150, 110, .07); --glow-c: rgba(90, 160, 230, .07);
    --routes: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 1600 1000%22 preserveAspectRatio=%22xMidYMid slice%22%3E%3Cpath d=%22M-40 820 Q 520 260 1180 520%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%228 10%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M120 1040 Q 760 380 1660 300%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%226 12%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M-60 300 Q 640 -60 1500 120%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%224 12%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M300 1060 Q 980 640 1680 860%22 fill=%22none%22 stroke=%22%23c9a8f0%22 stroke-opacity=%220.13%22 stroke-width=%222%22 stroke-dasharray=%228 14%22 stroke-linecap=%22round%22/%3E%3Ccircle cx=%221180%22 cy=%22520%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%221660%22 cy=%22300%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%221500%22 cy=%22120%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%221680%22 cy=%22860%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%22-40%22 cy=%22820%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%22120%22 cy=%221040%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Ccircle cx=%22300%22 cy=%221060%22 r=%225%22 fill=%22%23c9a8f0%22 fill-opacity=%220.21%22/%3E%3Cg transform=%22translate%281012 487%29 rotate%28-24%29 scale%281.6%29%22 fill=%22%23c9a8f0%22 fill-opacity=%220.26%22%3E%3Cpath d=%22M0 -2 L9 -2 L14 0 L9 2 L0 2 L-5 7 L-8 7 L-5 2 L-10 2 L-12 4 L-14 4 L-12 0 L-14 -4 L-12 -4 L-10 -2 L-5 -2 L-8 -7 L-5 -7 Z%22/%3E%3C/g%3E%3C/svg%3E"); }
body.bg-sky, body.bg-routes {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 8% -6%, var(--glow-a), transparent 70%),
    radial-gradient(800px 520px at 100% 0%, var(--glow-b), transparent 70%),
    radial-gradient(1000px 700px at 50% 115%, var(--glow-c), transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
}
body.bg-routes {
  background-image:
    var(--routes),
    radial-gradient(900px 520px at 8% -6%, var(--glow-a), transparent 70%),
    radial-gradient(800px 520px at 100% 0%, var(--glow-b), transparent 70%),
    radial-gradient(1000px 700px at 50% 115%, var(--glow-c), transparent 70%);
  background-size: cover, auto, auto, auto;
  background-position: center, 0 0, 0 0, 0 0;
  background-repeat: no-repeat;
}
.bg-swatches { display: flex; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 .5rem; }
.bg-swatch { display: flex; flex-direction: column; gap: .35rem; cursor: pointer; width: 150px; }
.bg-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.bg-swatch .bg-preview { width: 150px; height: 90px; border-radius: 10px; border: 2px solid var(--line);
  background-color: var(--bg); display: block; }
.bg-swatch input:checked + .bg-preview { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bg-swatch input:focus-visible + .bg-preview { outline: 2px solid var(--accent); outline-offset: 2px; }
.bg-preview.sky { background-image: radial-gradient(160px 90px at 8% -6%, var(--glow-a), transparent 70%),
  radial-gradient(140px 90px at 100% 0%, var(--glow-b), transparent 70%), radial-gradient(180px 120px at 50% 115%, var(--glow-c), transparent 70%); }
.bg-preview.routes { background-image: var(--routes), radial-gradient(160px 90px at 8% -6%, var(--glow-a), transparent 70%),
  radial-gradient(140px 90px at 100% 0%, var(--glow-b), transparent 70%), radial-gradient(180px 120px at 50% 115%, var(--glow-c), transparent 70%);
  background-size: 640px auto, auto, auto, auto; background-position: 62% 46%, 0 0, 0 0, 0 0; background-repeat: no-repeat; }

/* light/dark toggle in the top bar (v1.18) */
.top-actions { display: flex; align-items: center; gap: .5rem; }
.theme-toggle { display: inline-flex; margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn:hover { color: var(--ink); background: var(--bg); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn .ti { width: 18px; height: 18px; display: none; }
.icon-btn[data-theme-now="auto"] .ti-auto, .icon-btn[data-theme-now="light"] .ti-light,
.icon-btn[data-theme-now="dark"] .ti-dark { display: block; }

/* alerts shown as HTML (v1.19): the email layout in a sandboxed frame, sized to fit by base.html's script */
.alert-view { margin: .6rem 0 .2rem; }
.alert-frame { display: block; width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 10px;
  background: #f4f2ef; }
.alert-links { margin: .35rem 0; }

/* ---------- Availability calendar (v1.21; setting ui_availability, Account → Appearance) ---------- */
.cal { display: grid; gap: 6px; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head span { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 .3rem; }
.cal-day { border: 1px solid var(--line); border-radius: 9px; padding: .4rem .45rem .45rem; min-height: 5.5rem;
  background: var(--card); display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.cal-day.outside { background: transparent; border-style: dashed; opacity: .45; min-height: 0; }
.cal-day.has-hit { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.cal-day.today .cal-date { color: var(--accent); }
.cal-date { font-weight: 650; font-size: .85rem; }
.cal-wd { display: none; }
.cal-fare { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .35rem; padding: .2rem .3rem; border-radius: 6px;
  background: var(--bg); font-size: .8rem; line-height: 1.3; cursor: default; }
.cal-fare strong { font-size: .88rem; }
.cal-fare.hit { background: var(--good-soft); }
.cal-fare.hit strong { color: var(--good); }
.cal-cabin { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.cal-tax { color: var(--muted); font-size: .74rem; }
.cal-meta { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; width: 100%; }
.cal-meta .tag { font-size: .66rem; padding: 0 .3rem; }
.cal-seats { color: var(--bad); font-size: .7rem; }
.cal-none { color: var(--muted); font-size: .76rem; margin-top: auto; }
.cal-day.unpublished .cal-none { font-style: italic; }
/* narrow screens: one day per row (weekday names on the days instead of a header) */
@media (max-width: 760px) {
  .cal-head { display: none; }
  .cal-week { grid-template-columns: 1fr; gap: 6px; }
  .cal-day.outside { display: none; }
  .cal-day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .cal-date { width: 100%; }
  .cal-wd { display: inline; }
  .cal-fare { flex: 1 1 9rem; }
}

/* combined outbound + return calendar (v1.22). Leg colours are the chart palette's slots 1 and 2. */
:root { --leg-out: #2a78d6; --leg-ret: #eb6834; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --leg-out: #3987e5; --leg-ret: #d95926; }
}
:root[data-theme="dark"] { --leg-out: #3987e5; --leg-ret: #d95926; }
.cal-fare.leg-out, .cal-none.leg-out { border-left: 3px solid var(--leg-out); }
.cal-fare.leg-ret, .cal-none.leg-ret { border-left: 3px solid var(--leg-ret); }
.cal-none.leg-out, .cal-none.leg-ret { padding-left: .3rem; margin-top: 0; }
.cal-leg { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.leg-out .cal-leg, .leg-key.leg-out { color: var(--leg-out); }
.leg-ret .cal-leg, .leg-key.leg-ret { color: var(--leg-ret); }
.leg-key { font-weight: 700; }
.cal-day.is-out.is-ret { background: linear-gradient(135deg, color-mix(in srgb, var(--leg-out) 6%, var(--card)), color-mix(in srgb, var(--leg-ret) 6%, var(--card))); }
.cal-gap { text-align: center; color: var(--muted); font-size: .8rem; padding: .3rem; border: 1px dashed var(--line); border-radius: 9px; }

/* notes under the availability card(s) (v1.22.1) */
.avail-notes { margin-top: .9rem; }
.avail-notes p { margin: 0 0 .45rem; }
.avail-notes p:last-child { margin-bottom: 0; }

/* reward voucher option seats in the availability calendar/table (v1.22.2): purple, like the voucher card */
.tag.voucher { background: var(--accent-soft); color: var(--accent); }
.cal-fare.vhit { background: var(--accent-soft); }
.cal-fare.vhit strong { color: var(--accent); }
.cal-fare.hit.vhit { background: var(--good-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-fare.hit.vhit strong { color: var(--good); }
.cal-day.has-vhit:not(.has-hit) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
table.avail td.vhit, .swatch.vhit { background: var(--accent-soft); }
table.avail td.vhit strong { color: var(--accent); }
table.avail td.hit.vhit { background: var(--good-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.swatch.vhit { border-color: var(--accent); }

/* System page logs: "Show last" page sizes and pager (v1.23) */
.log-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0 0 .6rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg a { padding: .2rem .6rem; text-decoration: none; color: var(--muted); font-size: .85rem; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.seg a:hover:not(.on) { background: var(--bg); color: var(--ink); }
.pager { display: flex; align-items: center; justify-content: center; gap: .35rem; flex-wrap: wrap; margin: .8rem 0 .2rem; font-size: .9rem; }
.pager a, .pager span { padding: .2rem .55rem; border-radius: 7px; text-decoration: none; }
.pager a:hover { background: var(--bg); }
.pager .on { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.log-filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin: 0 0 .7rem; }
.log-filters label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--muted); }
.log-filters .grow { flex: 1 1 12rem; }

/* type-to-search airport fields on the trip form (v1.24, static/airports.js) */
.ap-wrap { position: relative; display: block; }
.ap-wrap input { width: 100%; }
.ap-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .25rem;
  list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20,16,30,.16); max-height: 18rem; overflow-y: auto; min-width: 16rem; }
.ap-list li { display: flex; gap: .5rem; align-items: baseline; padding: .4rem .55rem; border-radius: 7px; cursor: pointer;
  font-size: .9rem; color: var(--ink); }
.ap-list li strong { min-width: 2.6rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ap-list li .muted { margin-left: auto; font-size: .8rem; text-align: right; }
.ap-list li.on, .ap-list li:hover { background: var(--accent-soft); }
.ap-names { display: block; color: var(--accent); font-size: .8rem; min-height: 1em; }
