/* 行動記録の見た目。白地・細い線・差し色は青1色。文字は BIZ UDPゴシック（無い端末はその次）。 */
:root {
  --fg: #1f2328;
  --sub: #5f6368;
  --faint: #80868b;
  --line: #e3e6ea;
  --line-strong: #c9ced4;
  --accent: #1a73e8;
  --accent-ink: #1558b0;
  --danger: #c5221f;
  --hover: #f1f3f4;
  --nav-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--fg);
  font-family: "BIZ UDPGothic", "Noto Sans JP", "Hiragino Sans", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }

.shell { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100svh; padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); }
/* ホーム画面から開いたときは 100svh が上の帯の分だけ短く伝わる（WebKit の不具合）＝100vh にする */
html.standalone .shell, html.standalone .loginwrap { min-height: 100vh; }

/* 線画の絵 */
.ic { width: 24px; height: 24px; display: inline-block; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

.iconbtn {
  width: 44px; height: 44px; border: 0; background: transparent; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--sub);
}
/* 押したあとに色が残らないよう、色の変化はマウスのある機械のときだけ */
@media (hover: hover) {
  .iconbtn:hover, .btn:hover, .datebtn:hover, .placerow:hover, .visitrow:hover, .rowbtn:hover, .card:hover, .todaychip.go:hover { background: var(--hover); }
  .iconbtn:hover { color: var(--fg); }
  .btn.primary:hover { background: var(--accent-ink); }
}
.iconbtn:disabled { opacity: .3; cursor: default; background: transparent; }
.iconbtn:focus-visible, .btn:focus-visible, .navbtn:focus-visible, .chip:focus-visible, .placerow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f1b8b6; }
.btn:disabled { opacity: .5; cursor: default; }

/* 上の帯（日付） */
.top {
  position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
.daybar { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; height: 60px; padding: 0 4px; }
.daybar .iconbtn { justify-self: center; }
.datewrap { justify-self: center; display: flex; align-items: center; gap: 6px; min-width: 0; }
.datebtn {
  position: relative; border: 0; background: transparent; padding: 6px 6px 6px 10px; border-radius: 10px; min-height: 44px;
  display: inline-flex; align-items: center; gap: 2px;
}
.datebtn .d { font-size: 20px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.datebtn .ic { width: 20px; height: 20px; color: var(--sub); }
.datebtn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; padding: 0; pointer-events: none; }
.todaychip { font-size: 14px; color: var(--accent-ink); border: 1px solid #aecbfa; border-radius: 999px; padding: 0 10px; line-height: 24px; white-space: nowrap; }
/* 押せる「今日」（ほかの日を見ているとき）は塗りのある形にして、ただの印と見分ける。押せる範囲は上下に広げて44pxにする */
.todaychip.go { position: relative; font: inherit; font-size: 14px; font-weight: 700; line-height: 24px; background: #e8f0fe; border-color: #e8f0fe; color: var(--accent-ink); }
.todaychip.go::after { content: ""; position: absolute; inset: -10px -4px; }
.titlebar { display: flex; align-items: center; gap: 4px; height: 60px; padding: 0 8px 0 20px; }
/* 長い名前は2行まで出し、それより長いときだけ末尾を省く */
.titlebar h1 {
  font-size: 20px; line-height: 1.3; margin: 0; flex: 1; min-width: 0; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
/* 狭い画面（幅360px以下）では日付の字を少し小さくして、日付と「今日」が1行に収まるようにする */
@media (max-width: 360px) {
  .datebtn .d { font-size: 17px; }
  .datebtn { padding-left: 6px; }
  .daybar { grid-template-columns: 46px 1fr 46px; }
}
.titlebar.withback { padding-left: 4px; }

/* その日のまとめ（1行・控えめに。一番目立つのは下の流れ） */
.summary { margin: 0; padding: 12px 20px 0; font-size: 14px; color: var(--sub); display: flex; gap: 16px; }
.summary b { color: var(--fg); font-size: 16px; margin-left: 2px; }

/* 一日の流れ。左の時刻・線の点・カードの題は同じ高さにそろえる */
.timeline { list-style: none; margin: 0; padding: 8px 16px 8px 12px; }
.tl { display: grid; grid-template-columns: 52px 24px 1fr; column-gap: 6px; }
.tl .when { text-align: right; padding-top: 19px; }
.tl .when .t1 { font-size: 16px; font-weight: 700; display: block; line-height: 24px; }
.tl .rail { position: relative; }
.tl .rail::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl:first-child .rail::before { top: 31px; }
.tl:last-child .rail::before { bottom: calc(100% - 31px); }
.tl.stay .rail .dot {
  position: absolute; left: 4px; top: 23px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
}
.tl.stay.unnamed .rail .dot { border-color: var(--sub); }
.tl.stay.now .rail .dot { background: var(--accent); }
.tl.move .rail::before { background: none; border-left: 2px dashed var(--line-strong); width: 0; }
.tl .body { padding: 6px 0; min-width: 0; }

.card {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px 12px 14px; background: #fff;
  display: flex; gap: 4px; align-items: center; text-align: left;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .txt { flex: 1; min-width: 0; display: block; }
.card .name { display: block; font-size: 18px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.card .meta { font-size: 14px; color: var(--sub); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.card .meta > span { white-space: nowrap; }
.card .meta .span { color: var(--fg); font-weight: 700; font-size: 16px; }
.card .chev { flex: none; color: var(--sub); display: inline-flex; padding: 0 4px; }
.nowchip { font-size: 14px; color: #fff; background: var(--accent); border-radius: 999px; padding: 0 10px; line-height: 24px; font-weight: 700; }
.noname { font-size: 14px; color: var(--sub); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 6px; line-height: 22px; }

.moveline { display: flex; align-items: center; gap: 10px; color: var(--sub); font-size: 14px; padding: 10px 2px 10px 6px; }
.moveline .ic { color: var(--sub); }
.moveline b { color: var(--fg); font-weight: 700; }

.empty { padding: 48px 24px; text-align: center; color: var(--sub); }
.empty .ic { width: 40px; height: 40px; color: var(--line-strong); margin-bottom: 8px; }
.loading { padding: 48px 24px; text-align: center; color: var(--sub); }
.errbox { margin: 16px; padding: 14px 16px; border: 1px solid #f1b8b6; border-radius: 12px; color: var(--danger); display: flex; align-items: center; gap: 12px; }
.errbox span { flex: 1; }

/* 下のメニュー */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.nav .in { max-width: 640px; margin: 0 auto; display: flex; height: var(--nav-h); }
.navbtn { flex: 1; border: 0; background: transparent; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.navbtn .ic { width: 28px; height: 28px; }
.navbtn[aria-current="page"] { color: var(--accent); }
.navbtn[aria-current="page"] .ic svg { stroke-width: 2.2; }

/* 場所（左端は題と同じ20pxにそろえる） */
.placelist { list-style: none; margin: 0; padding: 8px 8px; }
.placerow {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 8px 14px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left;
}
.placerow > .ic { color: var(--accent); }
.placerow .txt { flex: 1; min-width: 0; }
.placerow .name { display: block; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.placerow .sub { display: block; font-size: 14px; color: var(--sub); }
.placerow .chev, .visitrow .chev { color: var(--sub); display: inline-flex; }
.placeinfo { margin: 0; padding: 12px 20px 0; font-size: 14px; color: var(--sub); }

.visits { list-style: none; margin: 0; padding: 0 8px 16px; }
.visitrow {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 12px 8px 12px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; align-items: center;
}
.visitrow .vd { font-weight: 700; }
.visitrow .vt { color: var(--sub); font-size: 14px; grid-column: 1; }
.visitrow .chev { grid-column: 2; grid-row: 1 / span 2; }
.visitrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sectionlab { font-size: 14px; color: var(--sub); padding: 16px 20px 4px; font-weight: 700; }

/* 設定 */
.setlist { padding: 4px 16px 16px; }
.setitem { padding: 14px 4px; border-bottom: 1px solid var(--line); }
.setitem .lab { font-size: 14px; color: var(--sub); font-weight: 700; }
.setitem .val { margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.setitem .val .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.setitem .row { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.tokenbox { margin-top: 10px; border: 1px solid var(--accent); border-radius: 12px; padding: 12px 6px 12px 14px; display: flex; align-items: center; gap: 8px; }
.tokenbox .v { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.note { font-size: 14px; color: var(--sub); margin-top: 6px; }
.rowbtn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; color: var(--fg); }
.rowbtn .ic { color: var(--sub); }

/* 下から出る板 */
.sheetwrap { position: fixed; inset: 0; z-index: 20; background: rgba(32, 33, 36, .36); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; background: #fff; border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + var(--safe-bottom));
  max-height: calc(100svh - var(--safe-top) - 24px); overflow: auto;
}
@media (min-width: 700px) { .sheetwrap { align-items: center; } .sheet { border-radius: 18px; padding-bottom: 16px; } }
.sheet .head { display: flex; align-items: center; gap: 4px; min-height: 52px; }
.sheet .head h2 { flex: 1; font-size: 18px; margin: 0; }
.field { margin: 8px 0 16px; }
.field label, .field .lab { display: block; font-size: 14px; color: var(--sub); font-weight: 700; margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"] {
  width: 100%; height: 48px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { position: relative; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; font-size: 16px; }
.chip::after { content: ""; position: absolute; inset: -2px 0; }
.ctx { margin: 0 0 12px; font-size: 14px; color: var(--sub); }
.ctx b { color: var(--fg); font-size: 16px; }
.chip[aria-checked="true"] { border-color: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent); }
.formerr { color: var(--danger); font-size: 14px; margin: -4px 0 12px; }
.sheet .foot { display: flex; gap: 8px; justify-content: flex-end; }
.sheet .foot .btn { min-width: 112px; }
.sheet p { margin: 4px 0 16px; }

/* ログイン */
.loginwrap { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); }
.login { width: 100%; max-width: 360px; }
.login h1 { font-size: 24px; margin: 0 0 24px; display: flex; align-items: center; gap: 10px; }
.login h1 .ic { color: var(--accent); width: 30px; height: 30px; }
.login .btn { width: 100%; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); z-index: 30;
  background: #3c4043; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px);
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
