:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5b6573;
  --border: #d8dde3;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --visited: #2da44e;
  --visited-text: #ffffff;
  --chip: #eef1f4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --text: #e6edf3;
    --muted: #9198a1;
    --border: #30363d;
    --accent: #4493f8;
    --accent-text: #0d1117;
    --ok: #3fb950;
    --warn: #d29922;
    --bad: #f85149;
    --visited: #238636;
    --visited-text: #ffffff;
    --chip: #21262d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
a.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 14px; border-radius: 10px;
  background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600;
}
input[type="text"], input:not([type]) {
  min-height: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); flex: 1; min-width: 0;
}

.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.top h1 { font-size: 18px; margin: 0; }
.progress { font-weight: 700; font-variant-numeric: tabular-nums; }

main { padding: 12px 16px; max-width: 720px; margin: 0 auto; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.note { font-size: 13px; margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }

.locbar { display: grid; gap: 8px; }
.manual summary { color: var(--muted); font-size: 14px; cursor: pointer; padding: 4px 0; }
.manual form { margin-top: 6px; }

.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 12px 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 8px 14px; min-height: 40px; background: var(--surface); }
.seg input:checked + span { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -4px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; min-height: 40px; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  display: grid; gap: 6px;
}
.card .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .name { font-weight: 700; overflow-wrap: anywhere; }
.card .dist { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .sub { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.card .actions > * { flex: 1 1 140px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chip); }
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--warn); }
.chip.bad { color: var(--bad); }
.empty { padding: 16px; text-align: center; color: var(--muted); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.grid button {
  width: 100%; min-height: 52px; padding: 4px; font-size: 13px; line-height: 1.2;
  border-radius: 8px; background: var(--surface);
}
.grid button.visited { background: var(--visited); color: var(--visited-text); border-color: var(--visited); }
.detail { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }

.file { display: inline-flex; }
.file span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file:focus-within span { outline: 2px solid var(--accent); }
.file:not(.inline) { margin: 8px 0; }
code { font-size: 13px; background: var(--chip); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; border-radius: 0; min-height: 56px; background: transparent; color: var(--muted); }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* 行程（T-022） */
.next { border-color: var(--accent); }
.next .label { font-size: 13px; color: var(--accent); font-weight: 700; }
.legs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legs li { font-size: 14px; border-left: 3px solid var(--border); padding-left: 8px; }
.map { margin: 12px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.map svg { display: block; width: 100%; height: auto; }
.map .route { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.map .route.done { stroke: var(--visited); stroke-width: 2.5; }
.map .route.flight { stroke-dasharray: 4 4; }
.map .stop { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.map .stop.done { fill: var(--visited); stroke: var(--visited); }
.map .stop.other { fill: var(--warn); stroke: var(--warn); }
.map .stop.next { fill: var(--accent); stroke: var(--accent); }
.map .here { fill: none; stroke: var(--bad); stroke-width: 2.5; }
.map .legend { font-size: 10px; fill: var(--muted); }
.days { flex-wrap: wrap; margin: 4px 0 8px; }
.days button { border: 0; border-radius: 0; min-height: 40px; padding: 6px 12px; }
.days button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.timeline li {
  display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
.timeline .time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.timeline .what { overflow-wrap: anywhere; display: grid; gap: 4px; }
.timeline li.visit { border-left: 4px solid var(--accent); }
.timeline li.visit.done { border-left-color: var(--visited); }
.timeline li.visit.done_other { border-left-color: var(--warn); }
input[type="date"] {
  min-height: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 3;
  margin: 0 auto; max-width: 480px; padding: 10px 14px; border-radius: 10px;
  background: var(--text); color: var(--bg); text-align: center;
}
