/* Pastel app UI (the house style of Downloads/trip): grey-blue page, white 24 px cards, flat blue
   primary, pastel colour only on icons and tags, Noto Sans Thai throughout (single family by design). */
:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --ink: #1c1c1e;
  --sub: #8e8e93;
  --line: #f0f0f2;
  --primary: #007aff;
  --primary-hover: #0062cc;
  --primary-soft: #e5f1ff;
  --good: #34a853;
  --good-soft: #e7f6eb;
  --warn: #f5a623;
  --warn-soft: #fff4e0;
  --bad: #d64545;
  --bad-soft: #fbeaea;
  --purple: #9b6bd3;
  --purple-soft: #f3ecfb;
  --grey-soft: #f2f3f5;
  --pink: #e8618c;
  --pink-soft: #fdecf2;
  --out: #4a90d9; /* ขาไป */
  --out-soft: #e8f1fb;
  --ret: #f5a623; /* ขากลับ */
  --ret-soft: #fff4e0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  --radius: 24px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: "Noto Sans Thai", system-ui, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 16px; height: 16px; flex: none; }
.ic-lg { width: 24px; height: 24px; flex: none; }
.ic-xl { width: 30px; height: 30px; flex: none; }

/* layout: an app column even on a desktop screen */
.app { max-width: 512px; margin: 0 auto; padding: 20px 16px 40px; display: grid; gap: 14px; }
.app > * { min-width: 0; }
.title { display: flex; align-items: center; gap: 10px; margin: 4px 4px 0; font-size: 24px; font-weight: 700; }
.title .ic-lg { color: var(--primary); }
.title small { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--sub); }
.section { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px -4px; font-size: 15px; font-weight: 600; }
.section small { color: var(--sub); font-weight: 400; font-size: 13px; }
.muted { color: var(--sub); }
.note { font-size: 13px; color: var(--sub); line-height: 1.6; margin: 0; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.hero { border-radius: var(--radius); padding: 22px; background: var(--primary); color: #fff; display: grid; gap: 6px; }
.hero .label { color: rgba(255, 255, 255, 0.78); font-size: 14px; font-weight: 500; }
.hero .big { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: rgba(255, 255, 255, 0.9); }
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero.good { background: #2e9e5b; } .hero.warn { background: #e08e0b; } .hero.bad { background: var(--bad); }

/* pastel icon tile */
.tile { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.tile.blue { background: var(--primary-soft); color: var(--primary); }
.tile.out { background: var(--out-soft); color: var(--out); }
.tile.ret { background: var(--ret-soft); color: var(--ret); }
.tile.good { background: var(--good-soft); color: var(--good); }
.tile.warn { background: var(--warn-soft); color: var(--warn); }
.tile.bad { background: var(--bad-soft); color: var(--bad); }
.tile.purple { background: var(--purple-soft); color: var(--purple); }
.tile.grey { background: var(--grey-soft); color: #6b6b70; }
.tile.pink { background: var(--pink-soft); color: var(--pink); }

/* list rows inside a card, hairline dividers */
.rows > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .grow small { display: block; color: var(--sub); font-size: 13px; }
.row .end { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.row .end small { display: block; font-weight: 400; color: var(--sub); font-size: 12px; }

/* stat boxes */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--grey-soft); border-radius: 18px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat small { color: var(--sub); font-size: 12px; }
.stat.accent { background: var(--primary-soft); color: var(--primary); }

/* buttons */
.pill-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; background: var(--primary); color: #fff; border-radius: 999px; padding: 15px; font-weight: 600; font-size: 17px; transition: background 0.15s, transform 0.1s; }
.pill-btn:hover { background: var(--primary-hover); }
.pill-btn:active { transform: scale(0.98); }
.pill-btn.big { padding: 22px; font-size: 22px; }
.pill-btn:disabled { opacity: 0.5; }
.soft-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 10px 16px; font-weight: 600; font-size: 15px; }
.soft-btn.bad { background: var(--bad-soft); color: var(--bad); }
.soft-btn.good { background: var(--good-soft); color: #23813f; }
.soft-btn.wide { width: 100%; padding: 14px; }
.ghost-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--sub); font-size: 14px; padding: 6px 8px; border-radius: 999px; }

/* inputs */
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.field small { font-weight: 400; color: var(--sub); }
.soft-input { background: var(--grey-soft); border: 0; border-radius: 12px; padding: 13px 16px; width: 100%; min-width: 0; font-size: 16px; font-weight: 400; }
.soft-input:focus { outline: none; box-shadow: 0 0 0 2px var(--primary); background: #fff; }

/* choice chips (instead of dropdowns for ≤ 8 options) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; text-align: left; padding: 9px 14px; border-radius: 999px; background: var(--grey-soft); border: 2px solid transparent; font-size: 14px; color: #48484a; }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.chip-grid .chip { border-radius: 16px; padding: 12px; justify-content: flex-start; }
/* tram picker: each tram's own icon (colour + number + kind), picked by sight */
.chip-grid.tram-pick { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.tram-pick .chip { flex-direction: column; justify-content: center; text-align: center; gap: 4px; padding: 10px 6px; min-height: 104px; }
.tram-pick .chip b { display: block; font-size: 15px; color: var(--text, #1c1c1e); }
.tram-pick .chip small { display: block; font-size: 11.5px; color: var(--sub); line-height: 1.3; }
.tram-pick .chip.active b { color: var(--primary); }
.tram-pick .tram-icon { display: block; }
.row > .tram-icon, .sheet h2 .tram-icon { flex: none; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.15)); }

/* round check like trip's pay-check */
.check { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 13px; color: #6b6b70; line-height: 1.6; }
.check input { appearance: none; width: 24px; height: 24px; margin: 0; border-radius: 50%; border: 2px solid #d1d1d6; cursor: pointer; }
.check input:checked { background: var(--primary) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>') center / 14px no-repeat; border-color: var(--primary); }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--grey-soft); color: #6b6b70; }
.tag.good { background: var(--good-soft); color: #23813f; }
.tag.warn { background: var(--warn-soft); color: #b46c00; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.on-hero { background: rgba(255, 255, 255, 0.22); color: #fff; }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff; flex: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(28, 28, 30, 0.92); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); z-index: 50; max-width: calc(100vw - 32px); }
.error { color: var(--bad); font-size: 14px; min-height: 1.2em; margin: 0; }
details summary { cursor: pointer; color: var(--sub); font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
details summary::-webkit-details-marker { display: none; }
.switch { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; }
.switch input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.nw { white-space: nowrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); text-decoration: none; font-weight: 600; font-size: 13px; margin: 0 4px -6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
