:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #dddddd;
  --soft: #f4f4f4;
  --accent: #1a73e8;
  --accent-fg: #ffffff;
  --danger: #c62828;
  --warn-bg: #fff6e0;
  --err-bg: #fdecec;
  --ok: #2e7d32;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #eeeeee;
    --muted: #a0a0a0;
    --line: #333333;
    --soft: #1e1e1e;
    --accent: #8ab4f8;
    --accent-fg: #0b1a33;
    --danger: #ef9a9a;
    --warn-bg: #3a3000;
    --err-bg: #3b1616;
    --ok: #81c784;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px; line-height: 1.5;
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  text-align: center; padding: 14px 0; color: var(--muted); text-decoration: none; font-size: 15px;
}
.tabbar a.active { color: var(--accent); font-weight: 600; }

h2 { font-size: 17px; margin: 20px 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; }
.stack > * + * { margin-top: 10px; }
.right { margin-left: auto; }

button, .btn {
  font: inherit; font-size: 15px; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--soft); color: var(--fg);
  cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
}
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.danger { color: var(--danger); background: transparent; border-color: var(--danger); }
.link { background: none; border: none; color: var(--accent); padding: 4px 0; }
.big { display: block; width: 100%; font-size: 18px; padding: 16px; font-weight: 600; }
.icon { padding: 6px 0; min-width: 40px; flex: none; }

input, select, textarea {
  font: inherit; font-size: 16px; /* iOSのズーム防止 */
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg);
}
textarea { min-height: 70px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
label .req { color: var(--danger); }

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list > li { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list > li.tap { cursor: pointer; }
.list .title { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 14px; }

.card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.progress { color: var(--muted); font-size: 14px; }
.dest-name { font-size: 22px; font-weight: 700; margin: 4px 0; }
.dest-addr { font-size: 18px; margin: 4px 0 8px; word-break: break-all; }
.tel { color: var(--accent); }
.done { color: var(--ok); }
.status-done { color: var(--ok); }
.status-now { color: var(--accent); font-weight: 600; }

.notice { padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); font-size: 14px; }
.notice.err { background: var(--err-bg); }

table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px; vertical-align: top; }
table.grid th { background: var(--soft); font-weight: 600; white-space: nowrap; }
table.grid input { padding: 6px; font-size: 16px; min-width: 110px; }
table.grid tr.err td { background: var(--err-bg); }
table.grid tr.warn td { background: var(--warn-bg); }
.scroll-x { overflow-x: auto; }

dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--bg); color: var(--fg);
}
dialog::backdrop { background: rgba(0,0,0,.4); }

#toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: .92; }
