[hidden] { display: none !important; }
:root {
  --bg: #f4f1ea; --panel: #fffdf8; --ink: #1d2733; --muted: #6b7380; --line: #ddd6c8;
  --navy: #16324f; --go: #1f7a4d; --go-bg: #e3f3ea; --stop: #b4432f; --stop-bg: #f8e6e1;
  --warn: #a86400; --warn-bg: #fff1d6; --sel: #e8eef6;
  --r: 14px;
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.bar-left, .bar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 18px; letter-spacing: .04em; }
#routeSel { font-size: 18px; padding: 8px 10px; border-radius: 10px; border: 0; min-height: 44px; }
.seg { display: inline-flex; background: rgba(255,255,255,.12); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 16px; min-height: 40px; }
.seg button.on { background: #fff; color: var(--navy); font-weight: 700; }
.pill { padding: 6px 12px; border-radius: 99px; font-size: 14px; background: rgba(255,255,255,.15); }
.pill.ok { background: #2e6b4f; } .pill.warn { background: #c98a1b; color: #1d1300; } .pill.off { background: #5b6470; }
.icon-btn { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 10px; padding: 8px 12px; min-height: 40px; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 18px; min-height: 48px; font-size: 17px; color: var(--ink); }
.btn:disabled { opacity: .35; }
.btn.big { min-width: 140px; min-height: 64px; font-size: 22px; font-weight: 700; }
.btn.on { background: var(--go); border-color: var(--go); color: #fff; }
.btn.off { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.muted { color: var(--muted); } .err { color: var(--stop); }

/* 添乗員: 左右分割 */
.split { display: grid; grid-template-columns: minmax(240px, 34%) 1fr; height: calc(100vh - 64px - env(safe-area-inset-top)); }
.stops { list-style: none; margin: 0; padding: 8px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); }
.stop { display: grid; grid-template-columns: 58px 1fr auto auto; gap: 8px; align-items: center; padding: 14px 10px; border-radius: 10px; margin-bottom: 4px; min-height: 56px; }
.stop .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.stop .a { font-size: 16px; }
.stop .p { font-size: 15px; padding: 3px 9px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.stop.none .p { background: none; }
.stop.all .p { background: var(--go-bg); color: var(--go); }
.stop.all .t, .stop.all .a { color: var(--muted); }
.stop.sel { background: var(--sel); outline: 2px solid var(--navy); }
.detail { padding: 16px 20px; overflow-y: auto; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.big-time { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.where { font-size: 20px; font-weight: 700; } .land { color: var(--muted); }
.chk { display: inline-flex; gap: 8px; align-items: center; font-size: 15px; white-space: nowrap; }
.chk input { width: 22px; height: 22px; }
.kids { display: grid; gap: 10px; }
.kid { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.kid.done { background: var(--go-bg); border-color: #b9dcc7; }
.kid.unplanned { opacity: .6; border-style: dashed; }
.kid-name { font-size: 22px; font-weight: 700; }
.kid-sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.kid-sub b { color: var(--warn); }
.kid-rec { color: var(--go); font-weight: 700; margin-top: 4px; }
.nav { display: flex; justify-content: space-between; margin-top: 16px; }

/* 全員名簿 */
.roster { padding: 16px; }
.counts { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 18px; margin-bottom: 12px; }
.counts b { font-size: 24px; }
.c-wait b { color: var(--warn); } .c-on b { color: var(--go); } .c-off b { color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--r); overflow: hidden; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-size: 17px; vertical-align: top; }
th { background: #ece6d9; font-size: 14px; }
tr.unplanned { opacity: .55; }
.note { color: var(--warn); font-size: 14px; }
.st { padding: 4px 10px; border-radius: 99px; font-size: 15px; font-weight: 700; white-space: nowrap; }
.st-wait { background: var(--warn-bg); color: var(--warn); }
.st-on { background: var(--go-bg); color: var(--go); }
.st-off { background: #eceff2; color: var(--muted); }
.st-miss { background: var(--stop-bg); color: var(--stop); }
.c-miss b { color: var(--stop); }

/* ドライバー: 停留所と時刻を最大表示 */
.driver { padding: 12px 24px 24px; text-align: center; max-width: 1400px; margin: 0 auto; }
.drv-route { font-size: 20px; color: var(--muted); }
.drv-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.drv-clock { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; color: var(--ink); font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.drv-clock small { font-size: 20px; color: var(--muted); }
.drv-label { font-size: 22px; font-weight: 700; color: var(--muted); }
.drv-eta { font-size: 24px; font-weight: 700; color: var(--navy); min-height: 1.2em; margin-top: 4px; }
.drv-body { display: grid; gap: 16px; }
@media (orientation: landscape) and (min-width: 900px) {
  .drv-body:not(.nomap) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .drv-body:not(.nomap) .drv-map { height: calc(100vh - 190px); min-height: 360px; }
  .drv-body:not(.nomap) .drv-mapwrap { margin: 0; }
}
.drv-time { font-size: clamp(80px, 18vw, 160px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; margin: 8px 0; }
.drv-area { font-size: clamp(40px, 6.5vw, 72px); font-weight: 800; line-height: 1.15; }
.drv-land { font-size: clamp(20px, 3vw, 28px); color: var(--muted); margin-top: 6px; }
.drv-kids { font-size: 24px; margin: 18px 0 10px; }
.drv-names { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 8px 0; }
.drv-names span { font-size: 24px; font-weight: 700; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.drv-names .muted { width: 100%; }
.drv-nav { display: flex; justify-content: center; gap: 24px; margin: 22px 0; }
.drv-nav .btn.big { min-width: 200px; min-height: 84px; font-size: 30px; }
.drv-next { list-style: none; padding: 0; color: var(--muted); font-size: 22px; }
.drv-next li { padding: 6px; }

.pinbox, .setup, .empty { max-width: 460px; margin: 40px auto; padding: 24px; background: var(--panel); border-radius: var(--r); border: 1px solid var(--line); text-align: center; }
.pin-dots { font-size: 32px; letter-spacing: 12px; margin: 12px 0 20px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pad .btn.big { min-width: 0; }
.setup { text-align: left; display: grid; gap: 16px; }
.setup label { display: grid; gap: 6px; font-size: 15px; color: var(--muted); }
.setup input, .setup select { font-size: 18px; min-height: 52px; background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 17px; z-index: 10; }



/* 土日の案内・試験表示 */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; background: var(--warn-bg); color: #5a3b00; font-size: 16px; }
.banner.test { background: #e8eef6; color: var(--navy); }
.banner .btn { min-height: 44px; padding: 8px 16px; }

/* 乗った(大)・欠席・乗らなかった理由 */
.acts { display: grid; gap: 8px; justify-items: end; }
.acts .btn.big { min-width: 200px; min-height: 72px; font-size: 26px; }
.acts-sub { display: flex; gap: 8px; }
.btn.miss { background: var(--panel); color: var(--stop); border-color: #e3b5aa; min-height: 44px; padding: 8px 16px; font-weight: 700; }
.reason { font-size: 15px; min-height: 44px; max-width: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #fff; color: var(--ink); }
.kid.missed { background: var(--stop-bg); border-color: #e3b5aa; }
.kid.missed .kid-rec { color: var(--stop); }


/* 先生画面 */
.teacher { padding: 12px 16px 24px; }
.t-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.seg-light { background: #e4ddcf; }
.seg-light button { color: var(--ink); }
.seg-light button.on { background: var(--navy); color: #fff; }
#tCls { font-size: 17px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); padding: 6px 10px; background: #fff; }
.pad { padding: 16px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 99px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.chip-bus { background: #dfe9f5; color: var(--navy); }
.chip-pick { background: var(--go-bg); color: var(--go); }
.chip-ext { background: #fde68a; color: #6b4e00; }
.chg { display: inline-block; margin-left: 6px; padding: 3px 8px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 700; }
.ride { color: var(--muted); font-size: 13px; }
/* A 時間帯 */
.ta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ta-col h3 { margin: 4px 0 8px; font-size: 22px; } .ta-col h3 small { color: var(--muted); font-size: 14px; }
.ta-card { display: grid; gap: 4px; width: 100%; text-align: left; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font: inherit; color: inherit; }
.ta-card b { font-size: 18px; }
.ta-card.ext { background: #fff7d1; border-color: #f0d36b; }
/* B 一覧表 */
.tb tr { cursor: pointer; }
/* C タイムライン(名前の列は固定、時間は横にスライド) */
.tc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.tc-row { display: flex; align-items: stretch; min-height: 50px; border-bottom: 1px solid #efe9de; cursor: pointer; width: max-content; min-width: 100%; }
.tc-axis { min-height: 44px; cursor: default; }
.tc-name { position: sticky; left: 0; z-index: 5; flex: 0 0 170px; display: grid; align-content: center; padding: 4px 10px; background: var(--panel); border-right: 1px solid var(--line); box-shadow: 4px 0 6px -4px rgba(0,0,0,.12); }
.tc-name b { font-size: 16px; } .tc-name small { color: var(--muted); }
.tc-pinhint small { font-size: 12px; line-height: 1.3; }
.tc-track { position: relative; flex: 0 0 auto; height: auto; min-height: 50px; }
.tc-axis .tc-track { min-height: 44px; }
.tick { position: absolute; top: 6px; transform: translateX(-50%); font: inherit; font-size: 14px; font-weight: 700; color: var(--navy); background: #f3efe6; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; min-height: 32px; display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; z-index: 1; }
.tick.on { color: #fff; background: var(--navy); border-color: var(--navy); z-index: 3; }
/* 固定した時刻の縦線(全部の行に通す) */
.tc-pinline { position: absolute; top: 0; bottom: 0; border-left: 3px solid var(--navy); margin-left: -1px; z-index: 2; pointer-events: none; }
.tc-past { opacity: .35; }
/* 固定した時刻より前の子は、帯の文字を出さない(名前の下に時刻がある。左端で文字が切れて見えないように) */
.tc-past .tbar span, .tc-past .tbar-out, .tc-past .tc-ride, .tc-past .tc-absent { visibility: hidden; }
.tc-when { white-space: nowrap; } .tc-when .ico { vertical-align: -3px; }
.grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #e0d8c8; }
.tbar { position: absolute; left: 0; top: 11px; height: 28px; border-radius: 0 8px 8px 0; display: flex; justify-content: flex-end; align-items: center; }
.tbar span { padding: 0 8px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.tbar-bus { background: #dfe9f5; color: var(--navy); }
.tbar-pick { background: var(--go-bg); color: var(--go); }
.tbar-ext { background: #fde68a; color: #6b4e00; }
.tc-ride { position: absolute; top: 34px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tbar-out { position: absolute; top: 13px; padding: 2px 8px; border-radius: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.tc-absent { position: absolute; left: 40px; top: 13px; }
#tcUnpin { font-size: 13px; padding: 6px 8px; max-width: 150px; line-height: 1.3; text-align: left; }
/* 今日の変更の入力 */
.modal { position: fixed; inset: 0; background: rgba(20, 30, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.sheet { background: var(--panel); border-radius: 16px; padding: 20px; width: min(520px, 100%); display: grid; gap: 12px; max-height: 90vh; overflow-y: auto; }
.sheet h2 { margin: 0; } .sheet h3 { margin: 8px 0 0; font-size: 16px; }
.sheet label { display: grid; gap: 6px; color: var(--muted); font-size: 15px; }
.sheet input, .sheet select { font-size: 18px; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type { display: flex !important; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink) !important; font-size: 17px !important; }
.type input { width: 22px; height: 22px; min-height: 0; }
.sheet .row { display: flex; gap: 12px; }
.chg-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }

/* まとめて操作・1人ずつの操作 */
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 10px; background: #e8eef6; border-radius: 12px; font-weight: 700; }
.pick { width: 26px; height: 26px; }
.r-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn.sm { min-height: 44px; padding: 6px 12px; font-size: 15px; }
.reason.sm { max-width: 170px; }
.chip-absent { background: var(--stop-bg); color: var(--stop); }

/* 予定にない子を乗せる */
.pick-list { display: grid; gap: 6px; max-height: 38vh; overflow-y: auto; }
.pick-list .type span { display: grid; }
/* 所属ロゴ(プリスクール=赤 / アフタースクール=緑)と、バス・お迎えのアイコン */
.org { width: 20px; height: 20px; vertical-align: -4px; margin-right: 4px; flex: none; }
.kid-name .org { width: 24px; height: 24px; vertical-align: -5px; }
.stop .o { display: inline-flex; gap: 2px; min-width: 20px; }
.stop .o .org { margin: 0; width: 22px; height: 22px; }
.stop .o .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--navy); }
.ico { vertical-align: -3px; margin-right: 3px; flex: none; }
.tbar span, .tbar-out { display: inline-flex; align-items: center; }
.drv-preview { margin: 10px 16px 0; text-align: center; }
/* 今日の変更のしるし */
.alert { display: inline-flex; vertical-align: -3px; margin-right: 3px; }
.kid-name .alert svg { width: 22px; height: 22px; }
.chgbtn { display: inline-flex; align-items: center; gap: 4px; border-color: #f59e0b; color: #92400e; background: #fff7e6; }
.chgbtn.on { background: #f59e0b; color: #fff; }
.chgbtn.on svg path:first-child { fill: #fff; } .chgbtn.on svg path:last-child { fill: #f59e0b; }
.seg .cnt { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--navy); color: #fff; font-size: 12px; }
/* D 幼稚園ピックアップ */
.pk { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 20px; max-width: 760px; }
.pk h2 { margin: 0 0 8px; font-size: 20px; } .pk h3 { margin: 14px 0 6px; font-size: 16px; color: var(--navy); }
.pk ul { list-style: none; margin: 0; padding: 0; }
.pk li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 6px; border-bottom: 1px solid #efe9de; font-size: 17px; cursor: pointer; }
.pk-home { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.pk-total { font-weight: 700; margin-top: 12px; }

/* 画面ロック(6桁の番号)と、使う人を選ぶ画面 */
.lock, .who { max-width: 560px; margin: 24px auto; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); text-align: center; }
.lock h2, .who h2 { margin: 0 0 6px; }
.lock-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; }
.lock-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--navy); }
.lock-dots span.on { background: var(--navy); }
.lock .err { min-height: 1.4em; }
.lock-pad { display: grid; grid-template-columns: repeat(3, 88px); gap: 16px 24px; justify-content: center; margin: 8px 0 16px; }
.lk { width: 88px; height: 88px; border-radius: 50%; border: 1px solid var(--line); background: #f3efe6; font: inherit; font-size: 34px; font-weight: 600; color: var(--ink, #1c2733); cursor: pointer; }
.lk:active { background: var(--navy); color: #fff; }
.linkbtn { border: 0; background: none; color: var(--navy); text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.small { font-size: 13px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.who-btn { min-height: 64px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.who-btn.on { outline: 3px solid var(--navy); }
.who-btn.ghost { background: transparent; font-weight: 400; }
.who-other { display: flex; gap: 8px; justify-content: center; }
.who-other input { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 220px; }
.src { display: inline-block; padding: 1px 6px; border-radius: 6px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 700; margin-left: 4px; }

/* 置き去り防止の知らせ */
.sf { margin: 12px 16px 0; padding: 12px 16px; border-radius: 12px; font-size: 17px; display: grid; gap: 6px; }
.sf b { font-size: 19px; }
.sf-red { background: var(--stop); color: #fff; }
.sf-amber { background: var(--warn-bg); color: var(--warn); border: 2px solid var(--warn); }
.sf-check { background: var(--panel); border: 2px solid var(--navy); justify-items: start; }
.sf-ok { background: var(--go-bg); color: var(--go); font-weight: 700; font-size: 15px; }
.sf-names { font-weight: 700; }

/* 画面の下の版(小さく) */
.verfoot { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
/* コドモンレコの降園 */
.went { color: var(--go); font-weight: 700; }
/* ドライバーの地図 */
.drv-mapwrap { margin: 8px 0 14px; }
.drv-map { height: clamp(300px, 42vh, 520px); border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: #e9ecef; }
.drv-map-note { font-size: 15px; margin: 6px 0 0; }
/* 地図は薄く・灰色にして文字を目立たなくし、停留所の「時刻と駅名」を濃く出す(マイマップ風) */
.tiles-soft { filter: grayscale(0.85) contrast(0.85) brightness(1.08); }
.leaflet-tooltip.mk-time { font-size: 14px; font-weight: 700; color: var(--ink); padding: 2px 8px; border-radius: 8px; border: 2px solid var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.18); white-space: nowrap; }
.leaflet-tooltip.mk-time b { font-variant-numeric: tabular-nums; margin-right: 2px; }
.leaflet-tooltip.mk-time.past { color: #8b949e; border-color: #c4cad1; box-shadow: none; }
.leaflet-tooltip.mk-time.cur { background: var(--navy); color: #fff; border-color: var(--navy); font-size: 17px; }
.bus-me { background: none; border: 0; }
.bus-ico { width: 56px; height: 56px; border-radius: 50%; background: #fff; border: 3px solid #16324f; box-shadow: 0 2px 8px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; box-sizing: border-box; transition: transform .3s; }
.bus-me.west .bus-ico svg { transform: scaleX(-1); }

/* ドライバーの画面は、スクロールなしで1画面に収める(iPadの横向き・縦向き) */
body.drvfit { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
body.drvfit #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.drvfit #verFoot { display: none; }
body.drvfit .driver { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; padding: 6px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
body.drvfit .drv-top { padding: 2px 4px 6px; margin-bottom: 6px; }
body.drvfit .drv-body { flex: 1; min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
body.drvfit .drv-body.nomap { grid-template-rows: auto; align-content: center; }
body.drvfit .drv-main { min-height: 0; overflow: auto; }
body.drvfit .drv-mapwrap { margin: 0; min-height: 0; display: flex; flex-direction: column; }
body.drvfit .drv-map { flex: 1; height: auto; min-height: 150px; }
body.drvfit .drv-time { font-size: clamp(56px, min(18vw, 14vh), 160px); margin: 2px 0; }
body.drvfit .drv-area { font-size: clamp(30px, min(6.5vw, 6.5vh), 72px); }
body.drvfit .drv-land { font-size: clamp(16px, 2.4vh, 26px); margin-top: 2px; }
body.drvfit .drv-label { font-size: clamp(16px, 2.2vh, 22px); }
body.drvfit .drv-kids { font-size: clamp(18px, 2.6vh, 24px); margin: 8px 0 4px; }
body.drvfit .drv-nav { margin: 10px 0 6px; }
body.drvfit .drv-nav .btn.big { min-height: clamp(52px, 7.5vh, 84px); font-size: clamp(22px, 3vh, 30px); }
body.drvfit .drv-next { font-size: clamp(16px, 2.2vh, 22px); margin: 0; }
body.drvfit .drv-next li { padding: 2px; }
body.drvfit .drv-preview { margin: 6px 16px 0; }
@media (orientation: landscape) and (min-width: 900px) {
  body.drvfit .drv-body:not(.nomap) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  body.drvfit .drv-body:not(.nomap) .drv-map { height: auto; }
  body.drvfit .drv-main { display: flex; flex-direction: column; justify-content: center; }
}
.drv-ver { font-size: 12px; color: var(--muted); }
.facts { font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.drv-facts { font-size: 15px; }
body.drvfit .drv-main > .btn { align-self: center; }

/* 縦向き: 上半分=何時にどこへ、下半分=地図 */
@media (orientation: portrait), (max-width: 559px) {
  body.drvfit .drv-body:not(.nomap) { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  body.drvfit .drv-main { display: flex; flex-direction: column; justify-content: center; }
  body.drvfit .drv-time { font-size: clamp(56px, min(18vw, 11vh), 150px); }
  body.drvfit .drv-area { font-size: clamp(28px, min(6.5vw, 5.4vh), 64px); }
  body.drvfit .drv-kids { margin: 4px 0 2px; }
  body.drvfit .drv-nav { margin: 6px 0 0; }
  body.drvfit .drv-nav .btn.big { min-height: clamp(48px, 6.2vh, 76px); }
  body.drvfit .drv-next { display: none; }
}

/* 停留所・全員名簿: 上に一覧、下に地図。マップのタブ: 地図を全画面 */
body.mapsplit, body.mapfull { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
body.mapsplit #app, body.mapfull #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.mapsplit #verFoot, body.mapfull #verFoot { display: none; }
body.mapsplit .wm-top { flex: 1 1 58%; min-height: 0; overflow: auto; }
body.mapsplit .wm-top .split { height: 100%; }
body.mapsplit .wm-map { flex: 0 0 40%; min-height: 180px; padding: 6px 12px 10px; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.wm-full { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 12px 12px; }
body.mapsplit .drv-mapwrap, body.mapfull .drv-mapwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; }
body.mapsplit .drv-map, body.mapfull .drv-map { flex: 1; height: auto; min-height: 0; }
body.mapsplit .drv-map-note:empty, body.mapfull .drv-map-note:empty { display: none; }
.leaflet-tooltip.mk-time.leaflet-interactive { cursor: pointer; }
/* 地図(Leafletは z-index 400〜1000)より、ダイアログ・お知らせを上に */
.modal { z-index: 3000; } .toast { z-index: 3100; }
.drv-map, .wm-map, .wm-full { position: relative; z-index: 0; }

/* タブが5つになったので、横に1行で収まるように少し詰める(iPad横向き) */
#viewSeg button { padding: 9px 12px; }
@media (max-width: 1200px) { .bar { gap: 8px; } .bar-left, .bar-right { gap: 8px; } #viewSeg button { padding: 8px 10px; font-size: 15px; } .bar-right .icon-btn { padding-left: 10px; padding-right: 10px; } }

/* 管理 */
.admin { max-width: 720px; margin: 24px auto; padding: 0 16px; }
.adm-tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
.adm-tbl th, .adm-tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 16px; }
.adm-tbl th { width: 34%; color: var(--muted); font-weight: 600; }
.adm-acts { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.lock.adm #admBack { margin-top: 14px; }

/* 地図の駅名: ルート上=青、近く=水色。主な通りの名前=濃い灰色(白いふち) */
.geo-stn { background: none; border: 0; white-space: nowrap; }
.geo-stn i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 2px; background: #fff; border: 2px solid currentColor; }
.geo-stn span { position: absolute; left: 9px; top: -10px; font-size: 14px; font-weight: 800; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.geo-stn.on { color: #1257c7; }
.geo-stn.near { color: #4fb3e8; }
.geo-stn.near span { font-size: 13px; font-weight: 700; }
.geo-road { background: none; border: 0; white-space: nowrap; }
.geo-road span { position: absolute; transform: translate(-50%, -50%); font-size: 13px; font-weight: 700; color: #4a5563; letter-spacing: .06em; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }

/* 車内の人数・iPadの同期の一覧 */
.onbus { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: #e6f4ea; color: #1b5e20; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.drv-onbus { margin-top: 0; font-size: 18px; padding: 4px 12px; }
.dev-tbl th { width: auto; }
.dev-tbl tr.dev-amber td { background: #fff6dd; }
.dev-tbl tr.dev-red td { background: #fde8e8; }

/* 地図のアイコン(高齢のドライバーにも分かるよう、大きく・絵で) */
.stp { background: none; border: 0; }
.stp .stp-dot { width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; background: #fff; color: #16324f; border: 3px solid #16324f; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.stp.mk-cur .stp-dot { background: #16324f; color: #fff; font-size: 22px; border-width: 4px; box-shadow: 0 0 0 6px rgba(22,50,79,.22), 0 2px 6px rgba(0,0,0,.3); }
.stp.mk-past .stp-dot { background: #e9ecef; color: #6b7480; border-color: #aab2bb; box-shadow: none; }
.stp .stp-kids { position: absolute; right: -14px; bottom: -8px; display: flex; align-items: center; gap: 1px; padding: 1px 5px; border-radius: 999px; background: #f5c400; color: #3a2e00; font-size: 12px; font-weight: 800; border: 2px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.stp-school { background: none; border: 0; text-align: center; }
.stp-school .sch-ico { width: 48px; height: 48px; margin: 0 auto; padding: 4px; box-sizing: border-box; background: #fff; border: 3px solid #16324f; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.stp-school b { display: inline-block; margin-top: 2px; padding: 0 6px; font-size: 13px; color: #fff; background: #16324f; border-radius: 6px; white-space: nowrap; }
.drv-mapwrap { position: relative; }
.map-legend { position: absolute; left: 8px; bottom: 8px; z-index: 900; display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: calc(100% - 16px); padding: 5px 9px; background: rgba(255,255,255,.92); border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 12px; font-weight: 700; color: #16324f; pointer-events: none; }
.map-legend span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.map-legend i { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 11px; box-sizing: border-box; }
.map-legend .lg-sch { border-radius: 4px; }
.map-legend .lg-cur { background: #16324f; color: #fff; }
.map-legend .lg-next { background: #fff; color: #16324f; border: 2px solid #16324f; }
.map-legend .lg-past { background: #e9ecef; color: #6b7480; border: 2px solid #aab2bb; }
.map-legend .lg-kids { background: #f5c400; color: #3a2e00; width: 22px; border-radius: 999px; }
.stp-school.sch-cur .sch-ico { border-width: 4px; box-shadow: 0 0 0 7px rgba(22,50,79,.25), 0 2px 6px rgba(0,0,0,.3); }

/* 予定にない子・困ったとき(手順は番号と短い言葉で) */
.add-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.help-btn { display: inline-flex; align-items: center; gap: 6px; }
.guide { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.guide li { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 8px 6px; border-radius: 12px; background: #eef3f9; font-size: 14px; font-weight: 700; color: var(--ink); }
.guide li b { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.guide-why { margin: -4px 0 0; font-size: 13px; }
.help-case { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: #f4f6f8; }
.help-case .hc-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.help-case .hc-q { font-weight: 800; font-size: 16px; color: var(--ink); }
.help-case .hc-a { font-size: 14px; color: var(--ink); margin-top: 2px; line-height: 1.5; }
.org-guess summary { cursor: pointer; font-weight: 700; padding: 6px 0; } .org-guess div { line-height: 1.9; }

/* 練習モード(?demo=1) */
.demo-tag { padding: 2px 8px; border-radius: 999px; background: #e5483f; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 1px; white-space: nowrap; }
.demo-bar { position: fixed; right: 8px; bottom: 26px; z-index: 2500; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; }
.demo-open { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.95); border: 2px solid #e5483f; color: #b3261e; font: inherit; font-weight: 800; box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: pointer; }
.demo-menu { order: -1; display: flex; gap: 4px; padding: 6px; border-radius: 12px; background: #fff; border: 2px solid #e5483f; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.demo-menu[hidden] { display: none; }
.demo-menu a, .demo-menu button { padding: 4px 9px; border-radius: 999px; color: #16324f; text-decoration: none; font: inherit; font-weight: 700; background: none; border: 1px solid #c9d2dc; cursor: pointer; }
.demo-menu a.on { background: #16324f; color: #fff; border-color: #16324f; }
.demo-admin { font-size: 28px; font-weight: 800; text-align: center; padding: 48px 0; color: var(--ink); }

/* ───────── レスポンシブ(どの幅・向きでも崩れない) ─────────
 * 境目: 〜479px スマホ縦 / 480〜767px 大きいスマホ・スマホ横・小さいタブレット / 768〜1023px タブレット縦 / 1024px〜 基準(iPad横向き)/ 1440px〜 パソコン(中身の幅を1400pxまで)
 * 高さ: 〜560px(スマホ横など)は、画面いっぱいに固定せず、上から下へ流す */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
/* ノッチ・ホームバー */
.bar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
#app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
/* 押しやすさ(指でもマウスでも 44px 以上) */
.seg button, .icon-btn, #routeSel { min-height: 44px; }
.chk { min-height: 44px; }
.tick { min-height: 44px; top: 4px; }
.tc-axis, .tc-axis .tc-track { min-height: 54px; }
#tcUnpin { min-height: 44px; }
.demo-open, .demo-menu a, .demo-menu button { min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; }
.demo-tag { font-size: 13px; }
/* 小さすぎる文字を少し大きく */
.ride, .facts, .guide-why, .small, .tc-name small { font-size: 14px; }
.src, .seg .cnt { font-size: 13px; }
.tc-ride { font-size: 12px; }
.verfoot, .drv-ver { font-size: 13px; }
/* タブは折り返さず、入りきらないときは中で横に送る */
.seg { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 0 0 auto; white-space: nowrap; }
/* 長い言葉(英語など)で、はみ出さない */
.kid-main, .ta-card, .pk li, .help-case, .sf { min-width: 0; overflow-wrap: anywhere; }
.stop .a, .where, .land, .drv-area, .drv-land { min-width: 0; overflow-wrap: break-word; }
.chip, .st, .chg { white-space: normal; }
/* 地図のたたみボタン(狭い・低い画面だけ出す) */
.wm-toggle { display: none; }
/* ダイアログ: 画面に収め、下のボタンは常に見えるように */
.modal { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.sheet { max-height: calc(100dvh - 24px); max-width: 100%; }
.sheet .row { position: sticky; bottom: -20px; background: var(--panel); padding: 10px 0 4px; margin-bottom: -4px; flex-wrap: wrap; z-index: 1; }
.sheet .row .btn { flex: 1 1 auto; }
.pinbox, .setup, .empty { width: calc(100% - 24px); }
.lock, .who { width: calc(100% - 24px); }
.who-other { flex-wrap: wrap; } .who-other input { min-width: 0; flex: 1 1 180px; min-height: 44px; }
/* ドライバー: 前へ・次へは画面の幅に合わせて縮む */
.drv-nav { gap: 16px; }
.drv-nav .btn.big { flex: 1 1 0; min-width: 0; max-width: 260px; }
.drv-top { flex-wrap: wrap; row-gap: 4px; }

/* パソコン(広い画面): 中身は読みやすい幅に */
@media (min-width: 1440px) {
  .bar { padding-left: max(16px, calc((100vw - 1400px) / 2)); padding-right: max(16px, calc((100vw - 1400px) / 2)); }
  #app { width: 100%; max-width: 1400px; margin-left: auto; margin-right: auto; }
  body.mapsplit #app, body.mapfull #app, body.drvfit #app { align-self: center; }
}

/* タブレット縦・それより狭い: ヘッダーは2段(1段目=名前・便、2段目=タブ、右の操作は折り返す) */
@media (max-width: 1023px) {
  .bar { row-gap: 8px; }
  .bar-left { flex: 1 1 100%; }
  #routeSel { flex: 1 1 180px; min-width: 0; max-width: 100%; }
  #viewSeg { flex: 1 1 100%; }
  #viewSeg button { flex: 1 0 auto; }
  .bar-right { flex: 1 1 100%; justify-content: flex-end; }
  /* 表は、その部分だけ横に送る */
  .roster table, table.tb, .admin table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .roster, .teacher { padding-left: 12px; padding-right: 12px; }
}

/* 大きいスマホ・スマホ横・小さいタブレット以下: 停留所の一覧と中身は1列 */
@media (max-width: 767px) {
  .split { grid-template-columns: 1fr; height: auto; }
  .stops { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail { padding: 12px 14px; }
  .kid { flex-wrap: wrap; }
  .acts { width: 100%; justify-items: stretch; }
  .acts .btn.big { width: 100%; min-width: 0; }
  .acts-sub { flex-wrap: wrap; } .acts-sub > * { flex: 1 1 140px; max-width: none; }
  .r-acts .reason.sm { max-width: none; }
  .big-time { font-size: 34px; }
  .kid-name { font-size: 20px; }
  .detail-head { flex-wrap: wrap; }
  .counts { gap: 10px 14px; font-size: 16px; }
  .counts b { font-size: 20px; }
  .pk { padding: 12px 14px; }
  .pk-home { margin-left: 0; }
  .ta { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .tc-name { flex-basis: 130px; }
  .sf { margin: 10px 12px 0; }
}

/* 狭い画面・高さが低い画面: 地図は「地図を開く」で開く。画面は固定せず上から下へ流す */
@media (max-width: 767px), (max-height: 560px) {
  body.mapsplit { height: auto; overflow: visible; display: block; }
  body.mapsplit #app { display: block; }
  body.mapsplit #verFoot { display: block; }
  body.mapsplit .wm-top { overflow: visible; }
  body.mapsplit .wm-top .split { height: auto; }
  body.mapsplit .wm-toggle { display: block; width: calc(100% - 24px); margin: 10px 12px 0; }
  body.mapsplit .wm-map { display: none; }
  body.mapsplit.mapopen .wm-map { display: flex; height: min(70vh, 460px); min-height: 260px; border-top: 0; }
  .stops { max-height: none; }
  .split .stops { max-height: 40vh; }
}

/* スマホ縦 */
@media (max-width: 479px) {
  .bar { padding-top: calc(env(safe-area-inset-top) + 8px); padding-bottom: 8px; gap: 6px; }
  .brand { font-size: 16px; }
  .bar-right { gap: 6px; }
  .bar-right .icon-btn { padding: 8px 10px; }
  #viewSeg button { padding: 8px 10px; font-size: 15px; }
  .stop { grid-template-columns: 50px 1fr auto auto; padding: 12px 8px; }
  .types { grid-template-columns: 1fr; }
  .guide li { font-size: 13px; padding: 6px 4px; }
  .sheet { padding: 16px; }
  .lock-pad { grid-template-columns: repeat(3, 72px); gap: 12px 18px; }
  .lk { width: 72px; height: 72px; font-size: 28px; }
  .drv-nav { gap: 10px; }
  .t-head { gap: 8px; }
  .t-head > .muted { flex: 1 1 100%; }
  .adm-tbl th, .adm-tbl td { padding: 8px 10px; font-size: 15px; }
}

/* ドライバー: 横向きなら(スマホ横も)左=時刻、右=地図。縦向きなら上=時刻、下=地図 */
@media (orientation: landscape) and (min-width: 560px) and (max-width: 899px) {
  body.drvfit .drv-body:not(.nomap) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  body.drvfit .drv-body:not(.nomap) .drv-map { height: auto; }
  body.drvfit .drv-next { display: none; }
}
/* 高さが低い画面のドライバー: 文字を高さに合わせ、前へ・次へは下に(親指で押せる位置) */
@media (max-height: 560px) {
  body.drvfit .drv-main { justify-content: flex-start; }
  body.drvfit .drv-nav { margin-top: auto; padding-top: 6px; }
  body.drvfit .drv-time { font-size: clamp(44px, 15vh, 120px); }
  body.drvfit .drv-area { font-size: clamp(22px, 7vh, 48px); }
  body.drvfit .drv-label, body.drvfit .drv-land, body.drvfit .drv-kids { font-size: 16px; margin: 0; }
  body.drvfit .drv-nav .btn.big { min-height: 48px; font-size: 20px; }
  body.drvfit .drv-clock { font-size: 24px; } body.drvfit .drv-clock small { font-size: 15px; }
  body.drvfit .drv-route, body.drvfit .drv-onbus { font-size: 15px; }
  body.drvfit .driver { padding-top: 2px; }
  .map-legend { font-size: 11px; gap: 2px 6px; }
}
/* 縦向きのスマホのドライバー: 前へ・次へを上半分の下に寄せる */
@media (orientation: portrait) and (max-width: 767px) {
  body.drvfit .drv-main { justify-content: space-between; }
  body.drvfit .drv-time { font-size: clamp(56px, min(22vw, 10vh), 150px); }
  body.drvfit .drv-area { font-size: clamp(26px, min(8vw, 5vh), 56px); }
  body.drvfit .drv-route { font-size: 16px; }
  body.drvfit .drv-clock { font-size: 26px; } body.drvfit .drv-clock small { font-size: 16px; }
  body.drvfit .driver { padding-left: 10px; padding-right: 10px; }
}
/* 狭い幅で、中身の幅に引っぱられて広がらないように */
.bar-left, .bar-right, #viewSeg, #routeSel { min-width: 0; }
.setup > *, .sheet > *, .lock > *, .who > * { min-width: 0; }
.setup input, .setup select, .sheet input:not([type=radio]):not([type=checkbox]), .sheet select { width: 100%; max-width: 100%; }
/* タブも便の選択もない画面(ドライバー用など)は、ヘッダーを1段に */
@media (max-width: 1023px) {
  .bar-left:not(:has(#viewSeg:not([hidden]))) { flex: 0 1 auto; }
  .bar-left:not(:has(#viewSeg:not([hidden]))) ~ .bar-right { flex: 0 1 auto; }
}
@media (max-height: 560px) {
  .bar { padding-top: calc(env(safe-area-inset-top) + 6px); padding-bottom: 6px; }
  body.drvfit .drv-top { padding: 0 4px 4px; margin-bottom: 4px; }
  body.drvfit .drv-main > .btn, body.drvfit #reveal { min-height: 44px; padding: 6px 14px; font-size: 16px; }
  body.drvfit .drv-names span { font-size: 18px; padding: 4px 10px; }
  body.drvfit .drv-body { gap: 8px; }
}
/* とても低い画面(スマホ横の小さいもの): 時刻・停留所・前へ次へを優先し、ほかは省く */
@media (max-height: 420px) {
  body.drvfit .drv-label, body.drvfit .drv-land, body.drvfit .drv-ver { display: none; }
  body.drvfit .drv-time { font-size: clamp(40px, 16vh, 80px); }
  body.drvfit .drv-area { font-size: clamp(20px, 7.5vh, 36px); }
  body.drvfit .drv-kids { font-size: 15px; }
  body.drvfit .drv-main > .btn, body.drvfit #reveal { margin: 2px auto; }
  body.drvfit .drv-nav { gap: 10px; }
  body.drvfit .map-legend { display: none; }
}

/* 表: 狭い画面では折り返さず、表の中だけ横に送る */
@media (max-width: 1023px) {
  .roster th, .roster td, table.tb th, table.tb td { white-space: nowrap; }
  .roster td .note, .roster td .chip, table.tb .chip, table.tb .chg { white-space: nowrap; }
  .stop { grid-template-columns: 50px minmax(0, 1fr) auto auto; gap: 6px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .split { grid-template-columns: minmax(280px, 40%) minmax(0, 1fr); }
}
/* スマホ・低い画面: ヘッダーは上に固定せず、一緒に流れる(中身の場所を広く) */
@media (max-width: 767px), (max-height: 560px) {
  .bar { position: static; }
}
@media (max-width: 479px) {
  .bar-right .icon-btn, .bar-right .pill { font-size: 14px; }
  .bar-right .pill { padding: 6px 10px; }
}

/* スマホ幅: 全員名簿と先生の一覧表は、1人1枚のカードに(操作ボタンが横にはみ出さない) */
@media (max-width: 767px) {
  .roster table, table.tb { display: block; overflow: visible; background: none; }
  .roster thead, table.tb thead { display: none; }
  .roster tbody, table.tb tbody { display: grid; gap: 8px; }
  .roster tr, table.tb tr { display: grid; gap: 4px 10px; align-items: center; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
  .roster td, table.tb td { display: block; padding: 0; border: 0; white-space: normal; font-size: 16px; }
  .roster tr { grid-template-columns: 30px minmax(0, 1fr) auto auto; grid-template-areas: "sel name grade st" "sel stop stop stop" "acts acts acts acts"; }
  .roster td:nth-child(1) { grid-area: sel; } .roster td:nth-child(2) { grid-area: name; } .roster td:nth-child(3) { grid-area: grade; color: var(--muted); }
  .roster td:nth-child(4) { grid-area: stop; color: var(--muted); font-size: 15px; } .roster td:nth-child(5) { grid-area: st; } .roster td:nth-child(6) { grid-area: acts; }
  .roster td:empty { display: none; }
  .r-acts > * { flex: 1 1 130px; }
  table.tb tr { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "sel name cls" "sel how how" "sel chg bus"; }
  table.tb td:nth-child(1) { grid-area: sel; } table.tb td:nth-child(2) { grid-area: name; } table.tb td:nth-child(3) { grid-area: cls; color: var(--muted); }
  table.tb td:nth-child(4) { grid-area: how; } table.tb td:nth-child(5) { grid-area: chg; } table.tb td:nth-child(6) { grid-area: bus; color: var(--muted); font-size: 15px; text-align: right; }
}
@media (max-width: 767px) {
  .roster td .note, .roster td .chip, table.tb .chip, table.tb .chg { white-space: normal; }
  .roster tr, table.tb tr, .roster td, table.tb td { min-width: 0; }
  body.mapsplit { overflow-x: clip; }
}

/* 日付(今日 ⇔ 次の日)と、記録の行き先 */
.day-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.day-btn .day-k { font-size: 13px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.2); }
.day-btn.ahead { background: #f5c400; color: #16324f; border-color: #f5c400; }
.day-btn.ahead .day-k { background: #16324f; color: #fff; }
.day-btn:disabled { cursor: default; opacity: 1; }
.banner.ahead { background: #fff4c2; color: #3a2e00; border-bottom: 2px solid #f5c400; }
.banner.ahead b { font-size: 17px; }
.help-data { padding: 10px 12px; border-radius: 12px; background: #eef3f9; }
.help-data b { font-size: 16px; } .help-data ol { margin: 6px 0 0; padding-left: 22px; font-size: 15px; line-height: 1.6; }
@media (max-width: 479px) { .day-btn { font-size: 15px; padding: 6px 9px; } }
/* iPad横向き(基準)ではヘッダーを1段に保つ: 日付ボタンを詰め、「今日」の札は省く(次の日のときだけ「次の日」を出す) */
@media (max-width: 1279px) {
  .day-btn { font-size: 15px; padding: 6px 8px; gap: 4px; }
  .day-btn:not(.ahead) .day-k { display: none; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .bar, .bar-left, .bar-right { gap: 6px; }
  #routeSel { font-size: 16px; padding: 6px 6px; }
  #viewSeg button { padding: 8px 8px; font-size: 15px; }
  .bar-right .icon-btn { padding-left: 8px; padding-right: 8px; font-size: 15px; }
  .bar-right .pill { padding: 6px 9px; font-size: 13px; }
  .brand { font-size: 17px; letter-spacing: 0; }
}
@media (min-width: 1024px) and (max-width: 1179px) {
  .bar, .bar-left, .bar-right { gap: 4px; }
  #userBtn { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #viewSeg button { padding: 8px 7px; }
  #routeSel { max-width: 176px; }
  .day-btn { padding: 6px 6px; }
  .brand { font-size: 16px; }
  .demo-tag { padding: 2px 6px; letter-spacing: 0; }
}
@media (min-width: 1024px) and (max-width: 1179px) {
  .bar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .bar-right .icon-btn { padding-left: 7px; padding-right: 7px; }
  #routeSel { max-width: 168px; }
}

/* 来る時刻〜帰る時刻の帯(左も角を丸く) */
.tbar.tbar-span { border-radius: 8px; }

/* 更新ボタン(右上の同期の表示) */
.sync-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; border: 0; color: #fff; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.sync-btn .ico { margin: 0; flex: none; }
.sync-btn.warn { color: #1d1300; }
.sync-btn.busy .ico { animation: spin .9s linear infinite; }
.sync-btn.new { background: #f5c400; color: #16324f; font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 1024px) and (max-width: 1179px) {
  .bar-right .sync-btn { padding: 6px 7px; gap: 3px; }
  .sync-btn .ico { width: 14px; height: 14px; }
  #userBtn { max-width: 84px; }
  #routeSel { max-width: 158px; }
}

/* C タイムライン: 縦も横も、この枠の中だけで動かす(iPadのSafariで名前の列がずれないように) */
.tc { overflow: auto; max-height: max(320px, calc(100dvh - 220px)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.tc-row { height: 52px; min-height: 52px; }
.tc-row .tc-track { height: 52px; min-height: 52px; }
.tc-name { height: 52px; overflow: hidden; background: var(--panel); transform: translateZ(0); will-change: transform; z-index: 6; align-content: center; }
.tc-name b { display: flex; align-items: center; min-width: 0; white-space: nowrap; }
.tc-name b .tc-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tc-name b .alert, .tc-name b .org { flex: none; }
.tc-name small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 時刻の軸は上に固定。左上のマスは上と左の両方に固定し、いちばん前に */
.tc-axis { position: sticky; top: 0; z-index: 8; background: var(--panel); height: 54px; min-height: 54px; }
.tc-axis .tc-track { height: 54px; min-height: 54px; background: var(--panel); }
.tc-axis .tc-name.tc-pinhint { position: sticky; left: 0; top: 0; z-index: 10; height: 54px; }
.tc-pinhint small { white-space: normal; }
@media (max-width: 767px) { .tc { max-height: max(300px, calc(100dvh - 160px)); } }
@media (max-width: 767px) { .tc-pinhint small { font-size: 12px; line-height: 1.25; } }
