[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; 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: 24px; text-align: center; max-width: 900px; margin: 0 auto; }
.drv-route { font-size: 20px; color: var(--muted); }
.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(28px, 5vw, 48px); font-weight: 800; }
.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; }

@media (max-width: 700px) {
  .split { grid-template-columns: 1fr; height: auto; }
  .stops { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* 土日の案内・試験表示 */
.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); }
@media (max-width: 700px) { .kid { flex-wrap: wrap; } .acts { width: 100%; justify-items: stretch; } .acts .btn.big { width: 100%; } }

/* 先生画面 */
.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); padding: 8px 12px; overflow-x: auto; }
.tc-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; min-height: 48px; border-bottom: 1px solid #efe9de; cursor: pointer; }
.tc-axis { min-height: 28px; cursor: default; }
.tc-name { display: grid; padding-right: 8px; } .tc-name b { font-size: 16px; } .tc-name small { color: var(--muted); }
.tc-track { position: relative; height: 40px; min-width: 480px; }
.tc-axis .tc-track { height: 24px; }
.tick { position: absolute; top: 2px; transform: translateX(-50%); font-size: 13px; color: var(--muted); }
.grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #e0d8c8; }
.tbar { position: absolute; left: 0; top: 6px; 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; right: 4px; top: 10px; font-size: 12px; color: var(--muted); }
/* 今日の変更の入力 */
.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); }
.tbar-out { position: absolute; top: 8px; padding: 2px 8px; border-radius: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.tc-absent { position: absolute; left: 0; top: 8px; }
