:root {
  --bg: #faf7f2; --card: #fff; --ink: #1d2433; --muted: #5f6878; --line: #ebe5da;
  --brand: #1d4e89; --sky: #3b8fd9; --sun: #f08a5d; --accent: #2a9d8f; --warn: #d9822b; --idea: #8b7fd1; --danger: #b42318;
  --hero: linear-gradient(170deg, #cfe8ff 0%, #e9f4ff 45%, #fff1e6 100%);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #10161f; --card: #19212c; --ink: #e8ebf0; --muted: #9aa3b2; --line: #28313d; --brand: #8fc1f2; --sky: #5aa9ec; --accent: #4cc3b2;
    --hero: linear-gradient(170deg, #142a45 0%, #1a2a3d 50%, #3a2a2a 100%); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 20px; color: var(--brand); text-decoration: none; letter-spacing: .2px; display: inline-flex; align-items: center; gap: 7px; }
.brand svg { width: 26px; height: 26px; }
.net { font-size: 13px; background: #fff3cd; color: #7a5a00; padding: 2px 8px; border-radius: 10px; }
.brand { margin-right: auto; }
@media (max-width: 420px) { .brand { font-size: 18px; } .top { gap: 6px; } }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font-size: 22px; margin: 4px 0 4px; }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
a { color: var(--brand); }
button, .btn { font: inherit; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.small { padding: 6px 10px; font-size: 14px; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
a.card { display: block; color: inherit; text-decoration: none; }
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 28px; }
/* landing */
.sky { margin: -16px -16px 0; padding: 28px 20px 26px; background: var(--hero); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.sky .kicker { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sun); }
.sky h1 { font-size: 34px; line-height: 1.12; margin: 6px 0 10px; color: var(--brand); }
.sky p.lead { font-size: 17px; color: var(--ink); opacity: .85; max-width: 30em; margin: 0 0 18px; }
.sky .route { display: block; width: 100%; height: 86px; margin: 4px 0 6px; }
.btn.big { padding: 13px 22px; font-size: 17px; border-radius: 12px; box-shadow: 0 6px 16px rgba(29,78,137,.25); }
.pass { display: flex; background: var(--card); border-radius: 16px; box-shadow: 0 10px 30px rgba(29,78,137,.14); margin: 22px 0 6px; overflow: hidden; border: 1px solid var(--line); }
.pass .main { flex: 1; padding: 14px 16px; min-width: 0; }
.pass .stub { width: 96px; flex: none; border-left: 2px dashed var(--line); padding: 14px 10px; text-align: center; position: relative; background: linear-gradient(180deg, rgba(240,138,93,.08), rgba(59,143,217,.08)); }
.pass .stub::before, .pass .stub::after { content: ""; position: absolute; left: -9px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.pass .stub::before { top: -9px; } .pass .stub::after { bottom: -9px; }
.pass .stub b { display: block; font-size: 26px; line-height: 1.1; color: var(--brand); }
.pass .stub small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.pass .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.pass .lbl .em { text-transform: none; letter-spacing: 0; font-size: 12px; }
.pass h3 { margin: 2px 0 2px; font-size: 18px; }
.check { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.check li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.check i { width: 18px; height: 18px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; background: var(--accent); }
.check li.open i { background: transparent; border: 2px solid var(--warn); }
.check li.open { color: var(--muted); }
.feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.feat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.feat .e { font-size: 24px; } .feat b { display: block; margin: 4px 0 2px; } .feat span { font-size: 14px; color: var(--muted); }
@media (max-width: 560px) { .feats { grid-template-columns: 1fr; } .sky h1 { font-size: 30px; } }
/* trip cards as boarding passes */
a.pass { color: inherit; text-decoration: none; margin: 12px 0; box-shadow: 0 4px 14px rgba(29,78,137,.08); }
a.pass:active { transform: scale(.995); }
.pass .route-line { display: flex; align-items: center; gap: 6px; color: var(--sky); font-size: 13px; margin-top: 2px; }
.pass .route-line::before, .pass .route-line::after { content: ""; flex: 1; border-top: 2px dotted currentColor; opacity: .5; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
textarea { min-height: 90px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 6px 0; }
.bar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0 2px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--accent)); border-radius: 6px; }
/* trip page: TripIt-style dense timeline — time | icon on one line | details; day bars stick under the header */
.trip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.trip-head .sum { color: var(--sun); font-weight: 600; }
.days { margin-top: 6px; }
.day { margin-top: 12px; }
.day h3 { position: sticky; top: var(--hdr, 57px); z-index: 3; margin: 0; padding: 7px 12px; font-size: 14px; display: flex; gap: 8px; align-items: baseline;
  color: var(--brand); background: #eaf2fb; border-radius: 10px; }
.day h3 small { color: var(--muted); font-weight: 400; }
.day.today h3 { background: #fff0e4; }
.pill { font-size: 12px; font-weight: 700; color: #fff; background: var(--sun); padding: 1px 8px; border-radius: 10px; align-self: center; }
/* TripIt-style timeline: one continuous line, solid round icons, no boxes between items */
.tl { position: relative; margin-top: 4px; }
.tl::before { content: ""; position: absolute; left: 84px; top: 12px; bottom: 12px; border-left: 3px solid var(--sky); }
.item { min-width: 0; display: grid; grid-template-columns: 52px 30px minmax(0, 1fr); gap: 0 8px; padding: 10px; border-radius: 10px; cursor: pointer; position: relative; }
.item:active, .item:hover { background: rgba(59,143,217,.06); }
.item .t { text-align: right; font-size: 13.5px; font-weight: 600; padding-top: 5px; font-variant-numeric: tabular-nums; }
.item .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sky); position: relative; z-index: 1; }
.item .ic svg { width: 18px; height: 18px; fill: #fff; }
.item.pending .ic { background: var(--warn); }
.item.idea .ic { background: var(--card); border: 2px dashed var(--idea); }
.item.idea .ic svg { fill: var(--idea); }
.item .bd { min-width: 0; padding-top: 3px; }
.item b { display: block; font-size: 15px; line-height: 1.3; color: var(--brand); }
.item .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; margin-top: 1px; }
.item .snip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-color-scheme: dark) { .day h3 { background: #1d2b3c; } .day.today h3 { background: #3a2a22; } }
/* language picker in the header */
.lang { width: auto; padding: 5px 6px; font-size: 13px; border-radius: 8px; }
.conf { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 1px 6px; border-radius: 6px; color: var(--ink); }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); margin-left: 4px; }
.fab { background: var(--sun); position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); border-radius: 28px; padding: 14px 20px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 16px; }
dialog h2 { margin-top: 0; color: var(--ink); text-transform: none; font-size: 18px; letter-spacing: 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.actions .left { margin-right: auto; }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.tbl table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; max-width: 220px; }
.tbl select { padding: 4px; font-size: 13px; min-width: 110px; }
.code { font-size: 28px; letter-spacing: 8px; text-align: center; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
/* admin */
.navlink { font-weight: 600; text-decoration: none; padding: 6px 10px; border-radius: 10px; background: rgba(59,143,217,.12); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile { text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 26px; color: var(--brand); line-height: 1.1; }
.tile b.sm { font-size: 15px; }
.tile span { font-size: 13px; color: var(--muted); }
button.tile { cursor: pointer; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; }
.chip { flex: none; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 6px 12px; font-size: 14px; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.brow { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 6px 0; cursor: pointer; }
.brow .bd { font-size: 13px; color: var(--brand); font-weight: 600; } .brow .bd small { color: var(--muted); font-weight: 400; }
.brow .br { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.owe { color: var(--warn); } .paid { color: var(--accent); }
.tag.warn { background: rgba(217,130,43,.14); color: var(--warn); }
.tag.big { font-size: 14px; padding: 4px 12px; }
h3.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 18px 0 2px; }
.prow { display: grid; grid-template-columns: 90px auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.payf { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.payf input { flex: 1 1 120px; width: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 8px 16px; border-radius: 20px; z-index: 20; }
