:root {
  --avios-blue: #2d5495;
  --avios-blue-dark: #18386d;
  --avios-blue-deep: #122b55;
  --avios-blue-soft: #edf3fb;
  --avios-blue-pale: #f5f8fc;
  --sky: #dbe8f8;
  --white: #ffffff;
  --ink: #14233a;
  --text: #24354d;
  --muted: #66758a;
  --muted-2: #66758a;
  --line: #dfe7f0;
  --line-strong: #cbd8e6;
  --success: #18815f;
  --shadow: 0 22px 55px rgba(24, 56, 109, .10);
  --secondary: #5f6f84;
  --neutral-bg: #f1f4f7;
  --control-border: #7d8fa8;
  --on-accent: #ffffff;
  --user-bg: #122b55;
  --user-text: #ffffff;
  --hero-start: #122b55;
  --hero-middle: #2d5495;
  --hero-end: #426cab;
  --hero-text: #ffffff;
  --hero-secondary: #dce8f8;
  --error-border: #e4c8c8;
  --error-text: #7a3434;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --avios-blue: #a9ccff;
  --avios-blue-dark: #c6ddff;
  --avios-blue-deep: #e6efff;
  --avios-blue-soft: #253650;
  --avios-blue-pale: #192638;
  --white: #131e30;
  --ink: #f3f7ff;
  --text: #e0e9f5;
  --muted: #b1c1d6;
  --muted-2: #b1c1d6;
  --secondary: #b1c1d6;
  --neutral-bg: #223047;
  --line: #42536c;
  --line-strong: #647994;
  --control-border: #8195b1;
  --on-accent: #0b1729;
  --user-bg: #244268;
  --error-border: #ffa7a7;
  --error-text: #ffc5c5;
  --shadow: 0 22px 55px rgba(0,0,0,.35);
}
:root[data-theme="contrast"] {
  color-scheme: dark;
  --avios-blue: #ffe66d;
  --avios-blue-dark: #fff2ad;
  --avios-blue-deep: #ffffff;
  --avios-blue-soft: #171717;
  --avios-blue-pale: #000000;
  --white: #000000;
  --ink: #ffffff;
  --text: #ffffff;
  --muted: #ffffff;
  --muted-2: #ffffff;
  --secondary: #ffffff;
  --neutral-bg: #000000;
  --line: #ffffff;
  --line-strong: #ffffff;
  --control-border: #ffffff;
  --on-accent: #000000;
  --user-bg: #000000;
  --hero-start: #000000;
  --hero-middle: #000000;
  --hero-end: #000000;
  --hero-secondary: #ffffff;
  --error-border: #ffffff;
  --error-text: #ffe66d;
  --shadow: none;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--avios-blue-pale);
  color: var(--text);
  font-family: Arial, Helvetica, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--white);
  color: var(--avios-blue-deep);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.no-script { padding: 14px; color: var(--ink); background: var(--white); }
:is(a, button, input, select, textarea) { scroll-margin-top: 80px; }
:is(a, button, select, .messages):focus-visible {
  outline: 3px solid var(--avios-blue);
  outline-offset: 3px;
}
.reward-option:has(input:focus-visible) {
  outline: 3px solid var(--avios-blue);
  outline-offset: 2px;
}
.profile-heading h2 { margin: 0; font: inherit; }
.mobile-copy { display: none; }
.chat-intro { display: none; }
.profile-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; }
.profile-summary::-webkit-details-marker { display: none; }
.profile-summary .profile-heading { flex: 1; min-width: 0; margin: 0; }
.profile-summary:focus-visible, .app-notes summary:focus-visible { outline: 3px solid var(--avios-blue); outline-offset: 3px; border-radius: 8px; }
#profile-overview { display: block; margin-top: 5px; color: var(--secondary); font-size: 12px; font-weight: 400; line-height: 1.4; }
.profile-edit { display: flex; align-items: center; flex-shrink: 0; gap: 6px; font-size: 12px; color: var(--avios-blue); font-weight: 700; }
.profile-edit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
details[open] > .profile-summary .profile-edit svg { transform: rotate(180deg); }
.profile-bar[open] .reward-category-grid { margin-top: 16px; }
.profile-actions { display: flex; justify-content: flex-end; padding-top: 14px; }
.app-notes { padding: 0 20px 14px; font-size: 12px; color: var(--secondary); }
.app-notes summary { width: fit-content; margin: auto; padding: 8px; cursor: pointer; }
.app-notes .footer-note, .install-hint { font-size: 12px; line-height: 1.6; text-align: left; }
.install-hint { margin: 10px 0 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  width: min(1120px, calc(100% - 40px));
  height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--avios-blue-deep);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.025em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 auto;
}
.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}
.header-actions { display: flex; align-items: center; }
.header-actions { gap: 6px; }
.tools-button { width: 44px; padding-inline: 0 !important; }
.header-button {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--avios-blue);
  font-size: 12px;
  font-weight: 700;
}
.header-button:hover { background: var(--avios-blue-soft); border-color: var(--line-strong); }
.header-button:disabled { opacity: .55; cursor: default; }

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--hero-start) 0%, var(--hero-middle) 65%, var(--hero-end) 100%);
  color: var(--hero-text);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}
.hero::before {
  width: 540px;
  height: 190px;
  right: -130px;
  top: -95px;
  background: rgba(255,255,255,.085);
  transform: rotate(-12deg);
}
.hero::after {
  width: 430px;
  height: 130px;
  left: -120px;
  bottom: -84px;
  background: rgba(219,232,248,.10);
  transform: rotate(9deg);
}
.hero-inner {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 68px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--hero-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-size: clamp(42px, 6.4vw, 66px);
  line-height: 1.02;
  letter-spacing: -.045em;
  font-weight: 700;
}
.hero p {
  margin: 17px auto 0;
  max-width: 600px;
  color: var(--hero-secondary);
  font-size: 17px;
  line-height: 1.5;
}

.workspace-wrap {
  width: min(920px, calc(100% - 30px));
  margin: -32px auto 0;
  padding-bottom: 30px;
  position: relative;
  z-index: 3;
}
.app-shell {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.profile-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.profile-heading {
  flex: 0 0 auto;
  color: var(--avios-blue-deep);
  font-size: 12px;
  font-weight: 700;
}
.reward-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.reward-option {
  position: relative;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--secondary);
  user-select: none;
  transition: transform .15s ease;
}
.reward-option:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.reward-option:has(input:checked) {
  border-color: var(--line-strong);
  background: var(--avios-blue-soft);
  color: var(--avios-blue-deep);
}
.reward-option input { position: absolute; opacity: 0; pointer-events: none; }
.check-ui {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--control-border);
  border-radius: 50%;
  background: var(--white);
}
.reward-option input:checked + .check-ui { background: var(--avios-blue); border-color: var(--avios-blue); }
.reward-option input:checked + .check-ui::after {
  content: "";
  width: 6px;
  height: 3px;
  border: solid var(--on-accent);
  border-width: 0 0 1.6px 1.6px;
  transform: rotate(-45deg) translateY(-1px);
}
.reward-option > span:last-child { font-size: 11px; font-weight: 700; white-space: nowrap; }

.chat-panel { background: var(--white); }
.messages {
  min-height: 310px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 28px 28px 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.message { display: flex; margin: 0 0 22px; }
.message.user { justify-content: flex-end; }
.bubble { min-width: 0; max-width: min(740px, 92%); font-size: 14.5px; line-height: 1.62; overflow-wrap: anywhere; }
.message.user .bubble {
  white-space: pre-wrap;
  padding: 11px 14px;
  border-radius: 18px 18px 5px 18px;
  background: var(--user-bg);
  color: var(--user-text);
}
.message.assistant .bubble { width: 100%; color: var(--text); }
.message.assistant .answer-profile {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 11px;
}
.answer-profile-label {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.answer-profile-chip {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--avios-blue-soft);
  color: var(--avios-blue-deep);
  font-size: 9px;
  font-weight: 700;
}
.answer-profile-chip.none { background: var(--neutral-bg); color: var(--secondary); }
.message.assistant .bubble > :first-child { margin-top: 0; }
.message.assistant .bubble > :last-child { margin-bottom: 0; }
.message.assistant p { margin: 0 0 10px; }
.message.assistant h3 {
  margin: 20px 0 7px;
  color: var(--avios-blue-deep);
  font-size: 15px;
  letter-spacing: -.01em;
}
.message.assistant ul,
.message.assistant ol { margin: 7px 0 12px 19px; padding: 0; }
.message.assistant li { margin-bottom: 5px; }
.message.assistant strong { color: var(--avios-blue-deep); }
.message.assistant a { color: var(--avios-blue); text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
.message.assistant code { padding: 1px 4px; border-radius: 5px; background: var(--avios-blue-soft); font-size: .92em; }

.typing { display: inline-flex; gap: 4px; align-items: center; min-height: 28px; }
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.15s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .12s; }
.typing span:nth-child(3) { animation-delay: .24s; }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-4px); opacity: 1; } }

.suggestions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 2px 18px 14px;
}
.suggestions[hidden] { display: none; }
.suggestions button {
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--avios-blue-pale);
  color: var(--secondary);
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  transition: transform .15s ease;
}
.suggestions button::after {
  content: "→";
  display: block;
  margin-top: 5px;
  color: var(--avios-blue);
  font-size: 14px;
}
.suggestions button:hover {
  border-color: var(--line-strong);
  background: var(--avios-blue-soft);
  transform: translateY(-1px);
}

.composer {
  margin: 0 14px 14px;
  padding: 7px 7px 7px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid var(--control-border);
  border-radius: 17px;
  background: var(--white);
  box-shadow: 0 6px 22px rgba(24,56,109,.055);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer:focus-within {
  border-color: var(--avios-blue);
  box-shadow: 0 0 0 4px rgba(45,84,149,.075), 0 6px 22px rgba(24,56,109,.055);
}
.composer:has(textarea:focus-visible) { outline: 3px solid var(--avios-blue); outline-offset: 2px; }
.research-status { margin-left: 9px; font-size: 12px; color: var(--muted); }
.profile-status { color: var(--text); font-size: 12px; line-height: 1.5; margin: 10px 0 0; }
.profile-status:empty { display: none; }
textarea {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 140px;
  padding: 9px 0 7px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.45;
}
textarea::placeholder { color: var(--muted); }
input::placeholder { color: var(--muted); opacity: 1; }
.send-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--avios-blue);
  color: var(--on-accent);
  box-shadow: 0 5px 14px rgba(45,84,149,.20);
}
.send-button:hover { background: var(--avios-blue-dark); }
.send-button:disabled { opacity: .42; cursor: default; }
.send-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.footer-note {
  margin: 11px auto 0;
  text-align: center;
  color: var(--secondary);
  font-size: 9.5px;
  line-height: 1.45;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 760px) {
  .header-inner { width: min(100% - 24px, 1120px); height: 60px; }
  .brand { font-size: 16px; }
  .brand-mark { width: 29px; height: 29px; }
  .hero-inner { width: min(100% - 28px, 920px); padding: 42px 0 58px; }
  .hero h1 { font-size: clamp(38px, 11vw, 54px); }
  .hero p { font-size: 15px; }
  .workspace-wrap { width: min(100% - 16px, 920px); margin-top: -24px; }
  .profile-bar { align-items: flex-start; flex-direction: column; gap: 9px; padding: 12px 14px; }
  .profile-heading { display: none; }
  .messages { min-height: 300px; max-height: 57vh; padding: 22px 17px 9px; }
  .messages:empty { min-height: 48px; }
  .suggestions { grid-template-columns: 1fr; padding: 0 11px 11px; }
  .suggestions button { min-height: 48px; }
  .suggestions button::after { display: inline; margin-left: 6px; }
  .composer { margin: 0 8px 9px; }
}

@media (max-width: 480px) {
  .header-button { min-height: 34px; padding: 6px 11px; font-size: 11px; }
  .hero-inner { padding-top: 34px; }
  .eyebrow { font-size: 10px; }
  .reward-grid { gap: 5px; }
  .reward-option { min-height: 31px; }
  .bubble { max-width: 95%; }
}

/* Search mode */
.mode-switch-wrap {
  padding: 14px 18px 0;
  background: var(--white);
}
.mode-switch {
  width: fit-content;
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--neutral-bg);
}
.mode-button {
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 700;
}
.mode-button.active {
  background: var(--white);
  color: var(--avios-blue-deep);
  box-shadow: 0 1px 5px rgba(31, 61, 105, .10);
}
.own-ai-panel {
  margin-top: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--avios-blue-pale);
}
.own-ai-panel[hidden] { display: none; }
.own-ai-copy {
  display: grid;
  gap: 4px;
  color: var(--secondary);
  font-size: 11.5px;
  line-height: 1.48;
}
.own-ai-copy strong {
  color: var(--avios-blue-deep);
  font-size: 12px;
}
.provider-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}
.provider-button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--white);
  color: var(--secondary);
  font-size: 11px;
  font-weight: 700;
}
.provider-button:hover { border-color: var(--line-strong); }
.provider-button.active {
  border-color: var(--avios-blue);
  background: var(--avios-blue);
  color: var(--on-accent);
}
.own-ai-hint {
  margin: 9px 0 0;
  color: var(--secondary);
  font-size: 10px;
  line-height: 1.4;
}
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 22px;
  width: min(560px, calc(100% - 28px));
  padding: 11px 14px;
  transform: translate(-50%, 12px);
  opacity: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 12px 34px rgba(26, 52, 88, .16);
  font-size: 11.5px;
  line-height: 1.45;
  transition: transform .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tone="error"] { border-color: var(--error-border); color: var(--error-text); }

@media (max-width: 760px) {
  .mode-switch-wrap { padding: 11px 12px 0; }
  .own-ai-panel { padding: 12px; }
}

/* Categorised reward profile */
.profile-bar {
  display: block;
  padding: 16px 18px 18px;
}
.profile-heading {
  display: block;
  margin-bottom: 10px;
  color: var(--avios-blue-deep);
  font-size: 12px;
  font-weight: 700;
}
.reward-category-grid {
  display: grid;
  grid-template-columns: 1.35fr .8fr 1fr;
  gap: 10px;
}
.reward-category {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--avios-blue-pale);
}
.reward-category h3 {
  margin: 0 0 9px;
  color: var(--avios-blue-deep);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .015em;
}
.reward-category .reward-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reward-category .reward-option {
  background: var(--white);
}
.reward-detail-row {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.reward-detail-row label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.reward-detail-row select {
  min-height: 32px;
  padding: 5px 28px 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--avios-blue-deep);
  font-size: 11px;
  font-weight: 700;
  outline: none;
}
.reward-detail-row select:focus {
  border-color: var(--avios-blue);
  box-shadow: 0 0 0 3px rgba(45,84,149,.10);
}
.reward-detail-row[hidden] { display: none !important; }

.prompt-recovery { margin-top: 14px; border-top: 1px solid var(--line-strong); padding-top: 12px; }
.prompt-recovery h3 { font-size: 13px; margin: 0 0 8px; }
.prompt-recovery p, .prompt-recovery label { color: var(--text); font-size: 12px; line-height: 1.5; }
.prompt-recovery label { display: block; margin-bottom: 5px; }
.prompt-recovery textarea {
  display: block;
  width: 100%;
  height: 180px;
  max-height: 320px;
  padding: 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  resize: vertical;
  font-size: 14px;
  background: var(--white);
}
.prompt-recovery textarea:focus-visible { outline: 3px solid var(--avios-blue); outline-offset: 2px; }
.prompt-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.prompt-actions a { color: var(--avios-blue); font-size: 12px; padding: 10px 0; }
.clipboard-buffer { position: fixed; top: 0; left: -10000px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .reward-option input:checked + .check-ui { background: Highlight; border-color: Highlight; forced-color-adjust: none; }
  .reward-option input:checked + .check-ui::after { border-color: HighlightText; }
  .mode-button.active, .provider-button.active { outline: 2px solid Highlight; outline-offset: -3px; }
}

@media (max-width: 820px) {
  .reward-category-grid {
    grid-template-columns: 1fr 1fr;
  }
  .reward-category:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .profile-bar { padding: 12px; }
  .profile-heading { display: block; margin: 0 2px 9px; }
  .reward-category-grid { grid-template-columns: 1fr; gap: 8px; }
  .reward-category:first-child { grid-column: auto; }
  .reward-category { padding: 10px; }
  .reward-option > span:last-child { white-space: normal; }
  .reward-option, .provider-button, .mode-button, .header-button { min-height: 40px; }
  textarea, .prompt-recovery textarea { font-size: 16px; }
}

/* Phone layout: put the task on the first screen and keep the composer in reach. */
@media (max-width: 760px), (max-height: 500px) and (max-width: 960px) {
  body { background: var(--white); }
  .site-header { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); }
  .header-inner { height: 60px; width: calc(100% - 32px); }
  .brand { font-size: 17px; gap: 9px; }
  .brand-mark { width: 32px; height: 32px; }
  .header-button { min-height: 44px; padding: 10px 14px; font-size: 13px; }
  main { display: flex; flex-direction: column; min-height: calc(var(--app-viewport-height, 100svh) - 61px - env(safe-area-inset-top, 0px)); }
  .hero { flex: 0 0 auto; padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); }
  .hero-inner { padding: 18px 0; width: calc(100% - 40px); text-align: left; }
  .eyebrow, .desktop-copy { display: none; }
  .mobile-copy { display: inline; }
  .mobile-copy br { display: none; }
  .hero h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.035em; }
  .hero p { display: none; }
  .has-conversation .hero, .keyboard-open .hero { display: none; }
  .hero::after { display: none; }
  .workspace-wrap { display: flex; flex-direction: column; flex: 1; width: 100%; margin: 0; padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); }
  .app-shell { display: flex; flex-direction: column; flex: 1; overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
  .profile-bar { flex: 0 0 auto; margin: 12px 16px 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--avios-blue-pale); }
  .profile-summary { min-height: 64px; padding: 10px 12px; gap: 10px; }
  .profile-summary .profile-heading { font-size: 14px; }
  #profile-overview { max-height: 36px; overflow: hidden; font-size: 13px; }
  .profile-edit { font-size: 12px; }
  .profile-bar[open] .reward-category-grid { margin: 0; padding: 0 12px; grid-template-columns: 1fr; gap: 10px; }
  .reward-category:first-child { grid-column: auto; }
  .reward-category { padding: 12px; background: var(--white); }
  .reward-category h3 { font-size: 13px; margin-bottom: 10px; }
  .reward-category .reward-grid { gap: 8px; }
  .reward-option { min-height: 44px; padding: 9px 12px 9px 9px; gap: 8px; }
  .reward-option:hover, .suggestions button:hover { transform: none; }
  .reward-option > span:last-child { font-size: 13px; line-height: 1.35; white-space: normal; }
  .check-ui { width: 20px; height: 20px; flex: 0 0 auto; }
  .reward-detail-row { flex-wrap: wrap; }
  .reward-detail-row label { font-size: 13px; }
  .reward-detail-row select { min-height: 44px; font-size: 16px; }
  .profile-actions { padding: 12px; }
  .profile-actions button { width: 100%; color: var(--on-accent); background: var(--avios-blue); border-color: var(--avios-blue); }
  .profile-status { margin: 8px 20px 0; }
  .chat-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; }
  .mode-switch-wrap { padding: 10px 16px 0; }
  .mode-switch { display: flex; width: 100%; border-radius: 14px; padding: 4px; }
  .mode-button { flex: 1; min-height: 44px; padding: 10px; border-radius: 10px; font-size: 14px; }
  .own-ai-panel { padding: 14px; margin-top: 12px; }
  .own-ai-copy { font-size: 14px; gap: 6px; }
  .own-ai-copy strong { font-size: 15px; }
  .provider-options { gap: 8px; }
  .provider-button { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .own-ai-hint { font-size: 12px; line-height: 1.5; }
  .messages { flex: 1; min-height: 0; max-height: none; overflow: visible; padding: 20px 20px 0; }
  .messages:empty { display: none; }
  .message { scroll-margin-top: calc(77px + env(safe-area-inset-top, 0px)); }
  .chat-intro { display: flex; flex-direction: column; justify-content: center; flex: 1; padding: 28px 20px 6px; }
  .chat-intro h2 { font-size: 21px; line-height: 1.25; color: var(--avios-blue-deep); letter-spacing: -.02em; margin: 0 0 10px; }
  .chat-intro p { font-size: 14px; line-height: 1.6; color: var(--secondary); margin: 0; }
  .chat-intro[hidden], .chat-panel:has(#own-ai-panel:not([hidden])) .chat-intro { display: none; }
  .bubble { font-size: 16px; line-height: 1.65; max-width: 100%; }
  .message.user .bubble { max-width: 92%; }
  .answer-profile-label, .answer-profile-chip { font-size: 11px; }
  .answer-profile-chip { padding: 4px 8px; }
  .message.assistant h3 { font-size: 17px; }
  .suggestions { display: flex; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 16px; gap: 10px; padding: 12px 16px; margin-top: auto; }
  .suggestions button { flex: 0 0 190px; min-height: 62px; padding: 12px 14px; font-size: 13px; line-height: 1.4; scroll-snap-align: start; }
  .suggestions button::after { display: inline; margin-left: 8px; }
  .composer-dock { position: sticky; bottom: var(--keyboard-inset, 0px); z-index: 10; flex: 0 0 auto; padding: 12px 12px env(safe-area-inset-bottom, 0px); background: var(--white); border-top: 1px solid var(--line); }
  .composer { margin: 0; border-radius: 20px; padding: 7px 7px 7px 14px; gap: 8px; box-shadow: 0 4px 16px rgba(24,56,109,.06); }
  #chat-input { font-size: 16px; }
  .send-button { width: 48px; height: 48px; }
  .app-notes { padding: 2px 6px 4px; font-size: 12px; }
  .app-notes summary { padding: 10px 4px; min-height: 44px; }
  .app-notes[open] { max-height: 45svh; overflow-y: auto; }
  .app-notes .footer-note, .install-hint { font-size: 13px; }
  .keyboard-open .chat-intro, .keyboard-open .suggestions, .keyboard-open .app-notes:not([open]) { display: none; }
  .toast { bottom: calc(126px + var(--keyboard-inset, 0px) + env(safe-area-inset-bottom, 0px)); font-size: 14px; padding: 13px 16px; }
  .prompt-recovery h3 { font-size: 15px; }
  .prompt-recovery p, .prompt-recovery label, .prompt-actions a { font-size: 13px; }
  .prompt-actions { gap: 14px; }
  .prompt-actions a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (max-width: 760px) and (max-height: 700px) {
  .hero-inner { padding-block: 14px; }
  .hero h1 { font-size: 24px; }
  .chat-intro { padding: 20px 20px 8px; }
  .chat-intro p { display: none; }
  .suggestions button { min-height: 56px; }
}

@media (max-width: 960px) and (max-height: 500px) {
  .hero { display: none; }
  .profile-summary { min-height: 60px; padding: 10px 14px; }
  .chat-intro { display: none; }
}

/* Local planning, calculation and saved-recommendation tools. */
#tools-dialog {
  width: min(760px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  max-height: calc(var(--app-viewport-height, 100dvh) - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  position: fixed;
  top: calc(var(--app-viewport-top, 0px) + 12px + env(safe-area-inset-top, 0px));
  bottom: auto;
  margin: 0 auto;
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--white);
  color: var(--text);
  box-shadow: var(--shadow);
}
#tools-dialog::backdrop { background: rgba(18,43,85,.45); backdrop-filter: blur(3px); }
.tools-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: -22px; z-index: 2; margin: -22px -22px 0; padding: 22px 22px 10px; border-bottom: 1px solid var(--line); background: var(--white); }
.tools-heading h2 { font-size: 22px; line-height: 1.25; letter-spacing: -.025em; color: var(--avios-blue-deep); margin: 0; }
.appearance-setting { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 16px 0; }
.appearance-setting label { font-size: 14px; font-weight: 700; }
.appearance-setting select { flex: 1; width: 100%; min-width: 0; max-width: 240px; min-height: 44px; padding: 10px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--white); color: var(--text); font-size: 16px; }
#appearance-status { flex-basis: 100%; margin: 0; }
#appearance-status:empty { display: none; }
.tool-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--white); color: var(--avios-blue-deep); font-size: 13px; font-weight: 700;
}
.tool-button.primary, .tool-button[aria-pressed="true"] { background: var(--avios-blue); border-color: var(--avios-blue); color: var(--on-accent); }
.tool-button:disabled { opacity: .55; }
.tools-tabs { display: flex; gap: 4px; padding: 4px; margin: 18px 0; border-radius: 14px; background: var(--avios-blue-pale); border: 1px solid var(--line); }
.tools-tabs button { flex: 1; min-width: 0; min-height: 44px; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: var(--secondary); font-size: 13px; font-weight: 700; }
.tools-tabs button[aria-selected="true"] { background: var(--white); color: var(--avios-blue-deep); box-shadow: 0 2px 7px rgba(24,56,109,.08); }
.tools-tabs button:focus-visible { outline-offset: -3px; }
.tool-copy, #tools-status { font-size: 14px; line-height: 1.6; color: var(--secondary); }
#tools-status { padding: 12px; border-radius: 12px; background: var(--avios-blue-pale); color: var(--text); overflow-wrap: anywhere; scroll-margin-top: 100px; }
#tools-status:empty { display: none; }
.tool-form { display: grid; gap: 16px; margin: 16px 0; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; }
.tool-form label { display: grid; align-content: start; gap: 7px; font-size: 13px; line-height: 1.5; font-weight: 700; min-width: 0; }
.tool-form :is(input, textarea):focus-visible { outline: 3px solid var(--avios-blue); outline-offset: 2px; }
.tool-form input:not([type="checkbox"]), .tool-form select, #tools-dialog textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--control-border); border-radius: 10px; background: var(--white); color: var(--text); font-size: 16px; font-weight: 400;
}
#tools-dialog textarea { min-height: 100px; max-height: 260px; resize: vertical; flex: none; }
.tool-form fieldset { margin: 0; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; min-width: 0; }
.tool-form legend { font-size: 14px; font-weight: 700; padding-inline: 6px; }
.tool-form select { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tool-form label.tool-check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; min-height: 44px; font-weight: 400; font-size: 14px; }
.tool-check input { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--avios-blue); }
.tool-link { display: inline-block; min-height: 44px; padding: 10px 0; color: var(--avios-blue); font-size: 14px; overflow-wrap: anywhere; }
.save-details { padding: 14px; margin: 16px 0; border: 1px solid var(--line-strong); border-radius: 14px; }
.save-details > summary, .saved-item summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: 15px; line-height: 1.5; color: var(--avios-blue-deep); font-weight: 700; overflow-wrap: anywhere; }
#tools-dialog summary:focus-visible { outline: 3px solid var(--avios-blue); outline-offset: 3px; border-radius: 5px; }
.saved-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.saved-item { border-top: 1px solid var(--line); padding: 14px 0; }
.saved-answer { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.saved-query { white-space: pre-wrap; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.saved-answer h3 { color: var(--avios-blue-deep); }
.saved-answer a { color: var(--avios-blue); }
.calculator-result { padding: 16px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--avios-blue-pale); overflow-wrap: anywhere; }
.calculator-result h3 { color: var(--avios-blue-deep); margin: 0 0 14px; font-size: 22px; }
.calculator-result p { font-size: 15px; line-height: 1.6; }
.calculator-result .tool-link { display: block; }
.comparison { margin: 14px 0 20px; }
.comparison-notice { color: var(--secondary); font-size: 13px; line-height: 1.6; margin: 0 0 12px !important; }
.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.comparison-card { min-width: 0; padding: 16px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--avios-blue-pale); overflow-wrap: anywhere; }
.comparison-card h4 { margin: 0 0 14px; font-size: 17px; line-height: 1.4; color: var(--avios-blue-deep); }
.comparison-card dl { margin: 0; }
.comparison-card dt { font-size: 12px; font-weight: 700; line-height: 1.5; color: var(--secondary); margin-bottom: 4px; }
.comparison-card dd { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.comparison-card dd p { margin: 0; }
.comparison-card dd:last-child { margin-bottom: 0; }
.comparison-card dd:last-child a { display: block; min-height: 44px; padding-block: 10px; }
.answer-narrative:empty { display: none; }
.message .tool-button { margin-top: 12px; }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  #tools-dialog { width: calc(100% - 16px); max-width: calc(100% - 16px); padding: 16px; border-radius: 16px; }
  .tools-heading h2 { font-size: 19px; }
  .tools-heading { top: -16px; margin: -16px -16px 0; padding: 16px 16px 10px; }
  .tools-tabs { margin-block: 14px; }
  .tools-tabs button { font-size: 12px; padding-inline: 4px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-form > .primary { width: 100%; }
  .comparison-grid { grid-template-columns: 1fr; }
  .comparison-card dd { font-size: 16px; }
}

/* Keep explicit high contrast distinct from the OS's forced-colour overrides. */
:root[data-theme="contrast"] .hero::before,
:root[data-theme="contrast"] .hero::after { display: none; }
:root[data-theme="contrast"] .hero { border-bottom: 2px solid var(--line); }
:root[data-theme="contrast"] .message.user .bubble { border: 1px solid var(--line); }
:root[data-theme="contrast"] :is(.mode-button.active, .provider-button.active, [role="tab"][aria-selected="true"], .reward-option:has(input:checked)) { outline: 2px solid var(--avios-blue); outline-offset: -2px; }
:root[data-theme="contrast"] :is(.composer, .send-button, .mode-button, .tools-tabs button, .toast) { box-shadow: none; }
:root[data-theme="contrast"] a { text-decoration: underline; }
:root[data-theme="contrast"] button:disabled { opacity: 1; background: var(--white); color: var(--secondary); border: 1px dashed var(--line); }
:root[data-theme="contrast"] .brand-mark { outline: 1px solid var(--line); border-radius: 9px; }
