:root {
  --bg: #f4f7f8;
  --card: #ffffff;
  --ink: #12232b;
  --muted: #5b6e77;
  --line: #dde5e8;
  --brand: #0e7490;
  --brand-ink: #ffffff;
  --red: #c62828;   --red-bg: #fdecec;
  --yellow: #a86b00; --yellow-bg: #fff4d6;
  --green: #2e7d32; --green-bg: #e7f5e8;
  --m-plane: #6a4fb3; --m-rail: #0e7490; --m-bus: #d97706; --m-shuttle: #b45309;
  --m-walk: #64748b; --m-taxi: #ca8a04; --m-car: #2563eb; --m-ferry: #0891b2;
  --shadow: 0 1px 3px rgba(16, 40, 50, .08);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1619; --card: #15232a; --ink: #e6eef1; --muted: #93a7b0; --line: #26373f;
    --brand: #22a3c4; --brand-ink: #04161c;
    --red: #ff8a80; --red-bg: #3a1d1d; --yellow: #ffcc66; --yellow-bg: #3a2f14;
    --green: #8bd48f; --green-bg: #183020;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1619; --card: #15232a; --ink: #e6eef1; --muted: #93a7b0; --line: #26373f;
  --brand: #22a3c4; --brand-ink: #04161c;
  --red: #ff8a80; --red-bg: #3a1d1d; --yellow: #ffcc66; --yellow-bg: #3a2f14;
  --green: #8bd48f; --green-bg: #183020;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Noto Sans Thai", "Noto Sans JP", system-ui, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--brand); }
.ja { font-family: "Noto Sans JP", sans-serif; }
.wrap { max-width: 680px; margin: 0 auto; padding: 12px 16px 24px; }

.top { background: var(--brand); color: var(--brand-ink); padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 680px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top h1 { margin: 0; font-size: 19px; }
.top .sub { margin: 0; font-size: 13px; opacity: .9; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn {
  width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.18); color: inherit; font-size: 18px; line-height: 36px; padding: 0;
}
.audit-pill { color: inherit; text-decoration: none; font-size: 13px; background: rgba(255,255,255,.18); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: 12px; padding: 8px 0 6px; }
.tabs a span { display: block; font-size: 20px; line-height: 1.2; }
.tabs a.on { color: var(--brand); font-weight: 600; }

.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 6px 12px; text-align: center; font: inherit; cursor: pointer;
}
.day-chip b { display: block; font-size: 17px; }
.day-chip small { color: var(--muted); font-size: 12px; }
.day-chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.day-chip.on small { color: inherit; opacity: .85; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; }
.day-head h2 { margin: 0 0 2px; font-size: 18px; }
.day-head .meta { color: var(--muted); font-size: 13px; }
.day-head .note { margin: 8px 0 0; font-size: 13px; }
.wx { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.wx .big { font-size: 26px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: grid; grid-template-columns: 52px 1fr; gap: 10px; }
.tl .time { text-align: right; font-weight: 600; font-size: 14px; padding-top: 12px; font-variant-numeric: tabular-nums; }
.tl .time small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.item { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.item .row { display: flex; gap: 10px; align-items: flex-start; }
.item .ic { font-size: 20px; line-height: 1.3; }
.item .title { font-weight: 600; }
.item .ja { color: var(--muted); font-size: 13px; }
.item .desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item .warn { color: var(--yellow); font-size: 13px; margin-top: 4px; }

.leg { border-left: 4px solid var(--mode, var(--muted)); }
.mode { display: inline-block; font-size: 12px; font-weight: 600; color: #fff; background: var(--mode, var(--muted)); border-radius: 6px; padding: 1px 8px; margin-right: 6px; }
.route { font-size: 14px; margin-top: 4px; }
.route .arrow { color: var(--muted); margin: 0 4px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fact { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; margin-top: 7px; }
.dot.red { background: var(--red); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); } .dot.none { background: var(--line); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.yellow { color: var(--yellow); background: var(--yellow-bg); }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.none { color: var(--muted); background: var(--bg); }

.section-title { font-size: 14px; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.search { width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); margin-bottom: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.filters button.on { background: var(--ink); color: var(--card); border-color: var(--ink); }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); flex: 0 0 auto; }
.check.done .text { text-decoration: line-through; color: var(--muted); }
.check .sub { font-size: 12px; color: var(--muted); }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--brand); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; padding: 12px 6px; border-radius: 12px; }
.stat b { display: block; font-size: 24px; }
.stat.red { background: var(--red-bg); color: var(--red); }
.stat.yellow { background: var(--yellow-bg); color: var(--yellow); }
.stat.green { background: var(--green-bg); color: var(--green); }
.finding { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.finding:last-child { border-bottom: 0; }
.finding .code { font-weight: 600; }

.fx { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.fx label { font-size: 12px; color: var(--muted); display: block; }
.fx input { width: 100%; font: inherit; font-size: 20px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
.fx .eq { padding-bottom: 10px; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-bottom: 0; }
.wx-list .wx-row { display: grid; grid-template-columns: 90px 36px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wx-list .wx-row:last-child { border-bottom: 0; }
.muted { color: var(--muted); font-size: 13px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  max-width: 680px; margin: 0 auto;
}
.sheet-close { position: sticky; top: 0; float: right; border: 0; background: var(--bg); color: var(--ink); width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.sheet h2 { margin: 0 0 2px; font-size: 20px; padding-right: 40px; }
.sheet .ja-big { font-size: 22px; margin: 4px 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 14px; margin: 12px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.callout { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.callout.red { background: var(--red-bg); } .callout.yellow { background: var(--yellow-bg); } .callout.green { background: var(--green-bg); } .callout.none { background: var(--bg); }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px);
  background: var(--ink); color: var(--card); font-size: 14px; padding: 8px 14px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
