/* Trip deals. Phone first; one column that widens on desktop. Self-hosted, no fonts to fetch. */
:root {
  --bg: #f4f8f8;
  --card: #ffffff;
  --text: #14242b;
  --muted: #4b5f68;
  --line: #d3dfe2;
  --brand: #0e7c78;
  --brand-dark: #0a5c59;
  --on-brand: #ffffff;
  --focus: #0b4fd1;
  --hi-bg: #dcf3e4; --hi-fg: #0f5a31;
  --mid-bg: #fdecc8; --mid-fg: #6e4300;
  --lo-bg: #fbe0e0; --lo-fg: #8a1b1b;
  --warn-bg: #fdecc8; --warn-fg: #6e4300;
  --info-bg: #e2f1f1;
  --demo-bg: #fff2c2; --demo-fg: #4a3800;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1a1e;
    --card: #15262c;
    --text: #e8f1f2;
    --muted: #a6bbc2;
    --line: #2b434b;
    --brand: #35b8b2;
    --brand-dark: #6fd3ce;
    --on-brand: #04201f;
    --focus: #8db4ff;
    --hi-bg: #16402a; --hi-fg: #a6ecc2;
    --mid-bg: #4a3710; --mid-fg: #fbdc95;
    --lo-bg: #4a1b1b; --lo-fg: #f7b5b5;
    --warn-bg: #4a3710; --warn-fg: #fbdc95;
    --info-bg: #17353a;
    --demo-bg: #4a3d0c; --demo-fg: #fbe9a0;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
a { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.block { display: block; }
.bad { color: var(--lo-fg); }
.big { font-size: 1.125rem; font-weight: 600; }
.h3 { font-size: 1rem; margin: 16px 0 6px; }

/* ----- top bar ----- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--brand); color: var(--on-brand);
}
.topbar h1 { font-size: 1.25rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }
.topbar .btn { background: transparent; color: var(--on-brand); border-color: var(--on-brand); }
.topbar .btn.primary { background: var(--on-brand); color: var(--brand-dark); }
.topbar .btn:disabled { opacity: 0.7; }
@media (prefers-color-scheme: dark) {
  .topbar { background: #0b3a3c; color: #e8f1f2; }
  .topbar .btn { color: #e8f1f2; border-color: #e8f1f2; }
  .topbar .btn.primary { background: #e8f1f2; color: #0b3a3c; }
}

.wrap { max-width: 920px; margin: 0 auto; padding: 12px 12px 32px; }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 8px 16px;
  border: 1.5px solid var(--brand); border-radius: 10px;
  background: var(--card); color: var(--brand-dark);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.linklike { background: none; border: 0; padding: 12px 0; min-height: 44px; font: inherit; color: var(--brand-dark); text-decoration: underline; cursor: pointer; }
.count {
  display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--brand); color: var(--on-brand); font-size: 0.8rem; line-height: 22px; text-align: center;
}
.topbar .btn.primary .count { background: var(--brand-dark); color: #fff; }

/* ----- banners ----- */
.banner { padding: 10px 14px; font-size: 0.9375rem; }
.banner.demo { background: var(--demo-bg); color: var(--demo-fg); text-align: center; }
.banner.info {
  background: var(--info-bg); border-radius: var(--radius); margin: 12px 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; justify-content: space-between;
}
.banner.info p { flex: 1 1 220px; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 560px; margin: 0 auto; padding: 12px 16px;
  background: var(--text); color: var(--bg); border-radius: 10px; font-size: 0.9375rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ----- segmented controls ----- */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 4px 0 12px; border: 1.5px solid var(--brand); border-radius: 12px; overflow: hidden; background: var(--card); }
.seg { position: relative; display: block; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 6px 4px; font-weight: 600; font-size: 0.875rem; line-height: 1.2; color: var(--brand-dark);
}
.seg + .seg span { border-left: 1.5px solid var(--brand); }
.seg input:checked + span { background: var(--brand); color: var(--on-brand); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.sorts { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--brand); border-radius: 10px; overflow: hidden; background: var(--card); flex: 0 0 auto; }
.small-seg span { min-height: 44px; padding: 4px 14px; }

/* ----- status ----- */
.status { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.status > summary {
  list-style: none; cursor: pointer; padding: 12px 40px 12px 14px; min-height: 48px; position: relative;
  font-size: 0.9375rem; font-weight: 600; display: flex; align-items: center;
}
.status > summary::-webkit-details-marker { display: none; }
.status > summary::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.status[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.status-body { padding: 0 14px 12px; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
progress { width: 100%; height: 10px; accent-color: var(--brand); }
.meter-row { display: grid; gap: 4px; }
.alerts { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; justify-items: start; }
.alerts h2 { margin: 0; }
.note { background: var(--info-bg); padding: 8px 10px; border-radius: 8px; }
.switch { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 15px; background: var(--muted); position: relative; margin: 0; cursor: pointer; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(22px); }
.switch input:disabled { opacity: 0.5; cursor: default; }
.dest-scan summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--brand-dark); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 4px; }
.signout { margin: 0; }

/* ----- list header ----- */
.listhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.listhead #summary { flex: 1 1 200px; }
.results { display: grid; gap: 12px; outline: none; }

/* ----- cards ----- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.card.first { border-color: var(--brand); border-width: 2px; padding: 13px; }
.card-head { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "price score" "id id"; gap: 6px 12px; align-items: center; }
.card-price { grid-area: price; }
.score { grid-area: score; }
.card-id { grid-area: id; }
.card-id h3 { font-size: 1.125rem; line-height: 1.25; overflow-wrap: anywhere; }
.dates { color: var(--muted); font-size: 0.875rem; }
.total { font-size: 1.5rem; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.what { color: var(--muted); font-size: 0.75rem; }
.score {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid currentColor;
  font: inherit; cursor: pointer; padding: 0;
}
.score .num { font-size: 1.25rem; font-weight: 800; line-height: 1; }
.score .of { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.03em; }
.score.hi, .score-big.hi { background: var(--hi-bg); color: var(--hi-fg); }
.score.mid, .score-big.mid { background: var(--mid-bg); color: var(--mid-fg); }
.score.lo, .score-big.lo { background: var(--lo-bg); color: var(--lo-fg); }
.legs { display: grid; gap: 10px; }
.leg { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 2px; align-content: start; }
.leg h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.leg-main { font-weight: 600; overflow-wrap: anywhere; }
.leg-sub { font-size: 0.9375rem; color: var(--muted); }
.leg-price { font-weight: 600; margin-top: 2px; }
.tag { display: inline-block; justify-self: start; font-size: 0.8125rem; padding: 2px 8px; border-radius: 6px; background: var(--info-bg); }
.tag.warn { background: var(--warn-bg); color: var(--warn-fg); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links .btn { flex: 1 1 0; white-space: nowrap; padding: 8px 10px; }
.alts summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 0.9375rem; font-weight: 600; color: var(--brand-dark); }
.alts ul { display: grid; gap: 6px; font-size: 0.875rem; color: var(--muted); padding: 0 0 4px 16px; list-style: disc; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 24px 16px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty h3 { font-size: 1.125rem; }
.foot { margin-top: 20px; }

@media (min-width: 640px) {
  .wrap { padding: 20px 16px 48px; }
  .legs { grid-template-columns: 1fr 1fr; gap: 20px; }
  .card { padding: 18px; }
  .card.first { padding: 17px; }
  .seg span { font-size: 1rem; }
  .modes { max-width: 520px; }
}
@media (min-width: 900px) {
  .results { gap: 14px; }
}

/* ----- sheets (dialogs) ----- */
dialog.sheet {
  border: 0; padding: 0; color: var(--text); background: var(--card);
  width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh;
  margin: auto 0 0; border-radius: 18px 18px 0 0;
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgba(5, 20, 24, 0.55); }
dialog.sheet form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h2 { font-size: 1.125rem; }
.sheet-body { overflow-y: auto; padding: 4px 14px 14px; flex: 1 1 auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; justify-content: space-between; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; background: var(--card); }
.sheet-foot .btn.primary { flex: 1 1 auto; }
@media (min-width: 640px) {
  dialog.sheet { max-width: 600px; margin: auto; border-radius: 18px; max-height: 88vh; max-height: 88dvh; }
  dialog.small-sheet { max-width: 480px; }
}

fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
legend { font-weight: 700; font-size: 1rem; padding: 0; margin-bottom: 6px; }
label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 4px; }
input[type="date"], input[type="number"], input[type="password"], select {
  width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 10px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0; }
.group-label { font-size: 0.875rem; font-weight: 600; margin: 12px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; margin: 0; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 22px;
  border: 1.5px solid var(--line); background: var(--bg); font-size: 0.9375rem; font-weight: 500;
}
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.chip input:checked + span::before { content: "\2713\00a0"; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.more { margin-top: 12px; }
.more > summary, .alts > summary, .dest-scan > summary { list-style: none; gap: 8px; }
.more > summary::-webkit-details-marker, .alts > summary::-webkit-details-marker, .dest-scan > summary::-webkit-details-marker { display: none; }
.more > summary::after, .alts > summary::after, .dest-scan > summary::after {
  content: ""; width: 8px; height: 8px; margin-left: 4px; margin-top: -3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.more[open] > summary::after, .alts[open] > summary::after, .dest-scan[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--brand-dark); }
.form-error { color: var(--lo-fg); background: var(--lo-bg); padding: 8px 12px; border-radius: 8px; margin-top: 12px; font-weight: 600; }

/* score sheet */
.score-big { display: inline-block; font-size: 2rem; font-weight: 800; padding: 4px 18px; border-radius: 12px; margin: 12px 0 8px; }
.parts { display: grid; gap: 12px; margin-top: 6px; }
.parts li { display: grid; gap: 3px; }
.part-top { display: flex; justify-content: space-between; gap: 8px; }
#score-body > p { margin-top: 8px; }

/* ----- login ----- */
.login-page { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; display: grid; gap: 12px; }
.login-card h1 { font-size: 1.5rem; }
.login-card form { display: grid; gap: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
