/*
 * KDS RIDEの画面（第 1 段：マスタ）。明るい画面・暗い画面の両方に合わせる。
 */
:root {
  --bg: #f3f6f9; --panel: #ffffff; --line: #d3dce4; --text: #17212a; --dim: #66737f;
  --accent: #1f6fb2; --accent-soft: #e8f1fa; --accent-strong: #185a91; --bad: #b42318; --warn: #9a6700; --warn-bg: #fff8e5;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820; --panel: #18232c; --line: #2f3d48; --text: #edf2f4; --dim: #9baab4;
    --accent: #3d8bd4; --accent-soft: #1a2b3b; --accent-strong: #7ab6ee; --bad: #f87171; --warn: #fbbf24; --warn-bg: #2b2416;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.loading { padding: 40px; color: var(--dim); }

/* 上の帯 */
.top { height: 52px; display: flex; align-items: center; gap: 18px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs a { padding: 7px 13px; border-radius: 8px; color: var(--dim); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tabs a:hover { background: var(--accent-soft); color: var(--accent-strong); }
.tabs a.on { background: var(--accent-soft); color: var(--accent-strong); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--dim); white-space: nowrap; }
.link { border: 0; background: none; color: var(--accent-strong); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.link:hover { background: var(--accent-soft); }
.viewas-bar { background: #f97316; color: #fff; padding: 6px 16px; font-weight: 700; display: flex; gap: 12px; align-items: center; }
.viewas-bar button { background: #fff; color: #9a3412; border: 0; border-radius: 6px; padding: 2px 10px; cursor: pointer; font-weight: 700; }

main { height: calc(100vh - 52px); }
.page { height: 100%; overflow: auto; padding: 18px 20px 40px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--dim); }
.small { font-size: 12.5px; }

/* 地点の画面：左に一覧、右に地図 */
.points { display: grid; grid-template-columns: 360px 1fr; height: 100%; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.side-head .row { display: flex; gap: 8px; align-items: center; }
.side-list { overflow: auto; flex: 1; }
.cat { border-bottom: 1px solid var(--line); }
.cat > summary { list-style: none; cursor: pointer; padding: 8px 12px; display: flex; gap: 8px; align-items: center; font-weight: 700; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.cat > summary::-webkit-details-marker { display: none; }
.cat > summary .n { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 12.5px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid rgba(0,0,0,.25); }
.pt { display: flex; gap: 8px; padding: 6px 12px 6px 32px; cursor: pointer; align-items: baseline; }
.pt:hover { background: var(--accent-soft); }
.pt.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.pt .nm { flex: 1; min-width: 0; }
.pt .sub { color: var(--dim); font-size: 12px; }
.pt.off .nm { color: var(--dim); text-decoration: line-through; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); margin-left: 4px; white-space: nowrap; }
.tag.teiji { background: var(--accent-soft); color: var(--accent-strong); }

.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.leaflet-container { background: #dde5e0; font: inherit; }
.map-legend { position: absolute; left: 12px; bottom: 26px; z-index: 500; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12.5px; }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.pin.off { opacity: .45; }
.pin.sel { width: 20px; height: 20px; box-shadow: 0 0 0 3px #111, 0 0 0 5px #fff; }
.school-pin { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }

/* 詳しい欄（地図の右上に重ねる） */
.detail { position: absolute; top: 12px; right: 12px; z-index: 600; width: 360px; max-height: calc(100% - 24px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; }
.detail h3 { margin: 0 0 4px; font-size: 16px; }
.detail .close { position: absolute; top: 8px; right: 8px; }
.form { display: grid; grid-template-columns: 112px 1fr; gap: 8px 10px; align-items: center; margin-top: 10px; }
.form label { color: var(--dim); font-size: 12.5px; }
.form input[type=text], .form input[type=number], .form input[type=date], .form select, .form textarea, .side-head input[type=search], .side-head select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.form textarea { min-height: 54px; resize: vertical; }
.form .checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.form .checks label { color: var(--text); font-size: 13.5px; display: flex; gap: 4px; align-items: center; }
.btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.danger { color: var(--bad); }
.hint { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; }
.teiji-list { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.teiji-list li { padding: 2px 0; border-bottom: 1px dashed var(--line); }

/* 表 */
table.grid { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: var(--accent-soft); color: var(--accent-strong); font-size: 12.5px; white-space: nowrap; }
.grid td.num, .grid th.num { text-align: right; }
.grid tr:last-child td { border-bottom: 0; }
.grid input[type=text], .grid input[type=number], .grid select { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.grid input[type=number] { max-width: 80px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.section { margin: 22px 0 10px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; background: #1f2a24; color: #fff; padding: 9px 16px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }

@media (max-width: 820px) {
  .points { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail { width: auto; left: 8px; right: 8px; top: auto; bottom: 8px; max-height: 70%; }
  .who .name { display: none; }
}

/* ---------------------------------------------------------------- 運行の計画（第 2 段） */
.dow0 { color: #dc2626; } .dow6 { color: #2563eb; }
@media (prefers-color-scheme: dark) { .dow0 { color: #f87171; } .dow6 { color: #60a5fa; } }
.calpage { display: grid; grid-template-columns: 1fr 380px; height: 100%; }
.cal-main { overflow: auto; padding: 14px 18px 30px; }
.cal-side { overflow: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 14px 16px 30px; }
.cal-side h3 { margin: 0 0 6px; font-size: 16px; }
.cal-side h4 { margin: 18px 0 6px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-head h2 { margin: 0 6px; min-width: 120px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-weight: 700; font-size: 12.5px; padding: 4px 0; cursor: default; border-radius: 6px; }
.cal-dow[title]:not([title='']) { cursor: pointer; }
.cal-dow[title]:not([title='']):hover { background: var(--accent-soft); }
.cal-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 86px; padding: 5px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.blank { background: none; border: 0; cursor: default; }
.cal-cell.past { opacity: .62; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.sel { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cal-cell.stop { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127,127,127,.08) 6px 12px), var(--panel); }
.cal-cell.stop.sel { background: var(--accent-soft); }
.cal-date { display: flex; gap: 4px; align-items: center; overflow: hidden; }
.cal-date .n { font-weight: 800; }
.mark { font-size: 10.5px; padding: 0 5px; border-radius: 8px; white-space: nowrap; }
.mark.sp { background: #fde68a; color: #78350f; }
.mark.sp:empty { display: none; }
.mark.open { background: var(--accent-soft); color: var(--accent-strong); margin-left: auto; }
.mark.lim { background: #fee2e2; color: #991b1b; align-self: flex-start; }
.cal-pat { font-size: 12px; line-height: 1.3; border-left: 4px solid var(--c); padding-left: 5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-pat.stop { color: var(--dim); border-left-color: transparent; font-weight: 700; }
.cal-note { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i, .pat-item i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; }
.day-pat { font-size: 16px; font-weight: 800; border-left: 6px solid var(--c, transparent); padding-left: 8px; margin: 6px 0; }
.ev-list { display: flex; flex-wrap: wrap; gap: 4px; }
.ev { font-size: 11.5px; padding: 1px 7px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); white-space: nowrap; }
.ev.okuri { background: #e0e7ff; color: #3730a3; }
@media (prefers-color-scheme: dark) { .ev.okuri { background: #1e1b4b; color: #c7d2fe; } .mark.lim { background: #450a0a; color: #fecaca; } .mark.sp { background: #422006; color: #fde68a; } }
.lim-list { list-style: none; margin: 6px 0; padding: 0; font-size: 12.5px; }
.lim-list li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 2px 0 8px; margin: 2px 3px 2px 0; }
.chip .x { border: 0; background: none; color: var(--bad); cursor: pointer; padding: 0 5px; font-weight: 700; }
.lim-add { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.lim-add summary { cursor: pointer; font-weight: 700; color: var(--accent-strong); }
.lim-add .checks, .cal-side .checks { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12.5px; }
.lim-add .checks label { display: inline-flex; align-items: center; gap: 3px; }
.lim-add select { width: 100%; margin: 4px 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.lim-pts { max-height: 220px; overflow: auto; }
.lim-pts .all { width: 100%; font-weight: 700; }
.cal-side .form { grid-template-columns: 70px 1fr; }
.cal-side .form input[type=text] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }

.patpage { display: grid; grid-template-columns: 260px 1fr; height: 100%; }
.pat-list { overflow: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 12px 0 24px; }
.pat-list h3 { margin: 0 14px 8px; font-size: 15px; }
.pat-list .btns { padding: 0 14px; }
.pat-item { display: flex; gap: 8px; align-items: center; padding: 6px 14px; cursor: pointer; font-size: 13.5px; }
.pat-item:hover { background: var(--accent-soft); }
.pat-item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.pat-item.off span { color: var(--dim); text-decoration: line-through; }
.pat-body { overflow: auto; padding: 14px 18px 30px; min-width: 0; }
.pat-form { max-width: 720px; grid-template-columns: 96px 1fr; margin-top: 0; }
.form input[type=time], .form input[type=color] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.form input[type=color] { width: 56px; height: 30px; padding: 2px; vertical-align: middle; }
.form .inline { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 13px; }
.ok-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-top: 8px; max-height: calc(100vh - 330px); }
.ok-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.ok-table th, .ok-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 3px 4px; text-align: center; white-space: nowrap; }
.ok-table thead th { position: sticky; top: 0; background: var(--accent-soft); color: var(--accent-strong); z-index: 2; }
.ok-table th.vert { vertical-align: bottom; height: 170px; padding: 6px 2px; }
.ok-table th.vert span { writing-mode: vertical-rl; display: inline-block; max-height: 160px; overflow: hidden; }
.ok-table .ev-head { position: sticky; left: 0; background: var(--panel); text-align: left; z-index: 1; min-width: 104px; cursor: pointer; }
.ok-table thead .ev-head { z-index: 3; background: var(--accent-soft); cursor: default; }
.ok-table .ev-head .bin { color: var(--dim); font-weight: 400; margin-left: 6px; font-size: 11px; }
.ok-table tr.mukae .ev-head { box-shadow: inset 3px 0 0 var(--accent); }
.ok-table tr.okuri .ev-head { box-shadow: inset 3px 0 0 #6366f1; }
.ok-table tr.okuri td, .ok-table tr.okuri th { border-bottom-width: 2px; }
.ok-table tr.none .ev-head { color: var(--dim); }
.ok-table td.ok { width: 26px; color: var(--dim); cursor: pointer; user-select: none; }
.ok-table td.ok.y { color: var(--accent); font-weight: 800; background: var(--accent-soft); }
.ok-table td.ok:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.ok-table .ev-time input { width: 92px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.rc-form { max-width: 760px; grid-template-columns: 130px 1fr; }
.rc-form input[type=number] { width: 72px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.rc-form .row { display: flex; gap: 6px; align-items: center; }

@media (max-width: 980px) {
  .calpage, .patpage { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; }
  main { height: auto; }
  .cal-side { border-left: 0; border-top: 1px solid var(--line); }
  .cal-cell { min-height: 64px; }
  .pat-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
}

/* ---------------------------------------------------------------- 予約と利用者（第 3 段） */
.count { font-weight: 800; font-size: 15px; }
.warn { color: var(--warn); }
.danger { color: var(--bad) !important; }
.subtabs { display: flex; gap: 4px; margin: 4px 0 12px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 6px 14px; cursor: pointer; color: var(--dim); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subtabs a.on { color: var(--accent-strong); border-bottom-color: var(--accent); }
.bins { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; align-items: start; }
.bin { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bin header { display: flex; gap: 6px; align-items: baseline; padding: 6px 10px; background: var(--accent-soft); color: var(--accent-strong); }
.bin.okuri header { background: #e0e7ff; color: #3730a3; }
@media (prefers-color-scheme: dark) { .bin.okuri header { background: #1e1b4b; color: #c7d2fe; } }
.bin header .n { margin-left: auto; font-weight: 800; }
.bin.empty { opacity: .55; }
.res { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 5px 10px; border-top: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.res .who { min-width: 130px; }
.res .where { flex: 1; min-width: 120px; }
.res .acts { margin-left: auto; white-space: nowrap; }
.res.temp { background: var(--warn-bg); }
.rec-head { margin-bottom: 10px; }
.rec-counts { display: flex; gap: 18px; margin-top: 6px; align-items: baseline; flex-wrap: wrap; }
.rec-counts .big { font-size: 16px; font-weight: 800; }
.bad { color: var(--bad); }
.st { font-size: 11.5px; padding: 1px 8px; border-radius: 9px; white-space: nowrap; }
.st.none { background: #fee2e2; color: #991b1b; }
.st.ok { background: var(--accent-soft); color: var(--accent-strong); }
.st.bus_only { background: var(--warn-bg); color: var(--warn); }
.les { display: inline-block; font-size: 11.5px; padding: 0 6px; margin: 1px 3px 1px 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); }
.les.gakka { background: #e0e7ff; color: #3730a3; }
table.rec tr.none td { background: rgba(254, 226, 226, .35); }
.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; width: min(640px, 94vw); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(0,0,0,.35); }
.dlg h3 { margin: 0 0 10px; }
.dlg-sec { margin: 12px 0; }
.dlg-sec .lbl { font-size: 12.5px; color: var(--dim); margin-bottom: 4px; font-weight: 700; }
.dlg input[type=search], .dlg input[type=text], .dlg select, .riderpage input[type=search] { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.rider-results { max-height: 220px; overflow: auto; margin-top: 4px; }
.rider-hit { display: block; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.rider-hit:hover { background: var(--accent-soft); }
.chip.big { font-size: 14px; padding: 3px 4px 3px 10px; }
.ev-pick { display: flex; flex-wrap: wrap; gap: 5px; }
.ev-pick label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; padding: 3px 9px; }
.ev-pick label:has(input:checked) { outline: 2px solid var(--accent); }
.riderpage { display: grid; grid-template-columns: 320px 1fr; height: 100%; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.form input[type=date] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.cal-head input[type=date] { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
@media (max-width: 980px) { .riderpage { grid-template-columns: 1fr; height: auto; } }

/* ---------------------------------------------------------------- 配車（第 4 段） */
.haisha { display: grid; grid-template-columns: minmax(0, 1fr) 600px; height: 100%; }
.hmapwrap { position: relative; min-width: 0; }
.hmap { position: absolute; inset: 0; }
.hside { display: flex; flex-direction: column; min-height: 0; overflow: auto; background: var(--panel); border-left: 1px solid var(--line); }
.hhead { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; position: sticky; top: 0; background: var(--panel); z-index: 5; }
.hhead .row, .hevents .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hday { font-size: 16px; margin: 0 4px; }
.state { font-weight: 800; font-size: 12.5px; padding: 2px 10px; border-radius: 10px; }
.st-u { background: var(--accent-soft); color: var(--accent-strong); }
.st-h { background: var(--warn-bg); color: var(--warn); }
.st-k { background: #132330; color: #fff; box-shadow: inset 0 0 0 1px #5aa2e6; }
.others { color: #1d4ed8; font-weight: 700; }
.printsel { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.hevents { padding: 8px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.evtable { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.grid.compact th, .grid.compact td { padding: 3px 8px; }
.evtable tr { cursor: pointer; }
.evtable tr.on td { background: var(--accent-soft); }
.evtable tr.empty td { color: var(--dim); }
.hruns { padding: 8px 12px 40px; display: grid; gap: 10px; align-content: start; }
.run { border: 1px solid var(--line); border-left: 6px solid var(--rc, #9ca3af); border-radius: 10px; background: var(--panel); }
.run.focus { box-shadow: 0 0 0 2px var(--rc); }
.run.unassigned { border-left-color: #9ca3af; background: var(--bg); }
.run.drop { outline: 3px dashed var(--accent); }
.run header { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.run header select { padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); max-width: 200px; }
.run .sw { width: 14px; height: 14px; border-radius: 4px; background: var(--rc, #9ca3af); }
.rwarn { padding: 4px 10px; background: var(--warn-bg); color: var(--warn); }
.stops { display: grid; }
.stop { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-bottom: 1px dashed var(--line); }
.stop:last-child { border-bottom: 0; }
.stop[draggable=true] { cursor: grab; }
.stop .time { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 52px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 1px 4px; cursor: pointer; text-align: center; }
.stop .time.manual { background: #fde68a; color: #713f12; border-color: #f59e0b; }
.stop .time.teiji { background: #dbeafe; color: #1e3a8a; border-color: #60a5fa; }
.stop .time:disabled { cursor: default; }
.sd { font-size: 11px; font-weight: 800; border-radius: 4px; padding: 0 4px; color: #fff; }
.sd.mukae { background: #2563eb; }
.sd.okuri { background: #ea580c; }
.st-body { flex: 1; min-width: 0; }
.st-body .n { margin-left: 6px; font-size: 11.5px; font-weight: 800; color: var(--accent-strong); }
.st-acts { display: flex; gap: 2px; }
.st-acts .link { font-size: 15px; padding: 0 4px; }
.hpin { width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.hpin.okuri { border-radius: 6px; }
.hpin.un { background: #fff; color: #374151; border: 2px dashed #6b7280; }
.hpop { display: grid; gap: 4px; min-width: 180px; }
.hpop select { padding: 3px; }
@media (max-width: 1100px) { .haisha { grid-template-columns: 1fr; grid-template-rows: 45vh auto; } .hside { border-left: 0; } }

/* ---------------------------------------------------------------- 勤務（第 5 段） */
a.btn { text-decoration: none; color: inherit; display: inline-block; }
.kinmu { display: grid; gap: 10px; align-content: start; }
.khead { display: grid; gap: 6px; }
.khead .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kwarn { margin: 0; padding: 8px 10px 8px 28px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; }
.ktable { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: clip; }
.krow { display: grid; grid-template-columns: 150px minmax(0, 1fr) 120px; border-top: 1px solid var(--line); }
.krow.kscale { border-top: 0; position: sticky; top: -18px; background: var(--panel); z-index: 3; }
.klabel { padding: 5px 10px; display: grid; align-content: center; gap: 1px; border-right: 1px solid var(--line); min-width: 0; }
.klabel b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ktotal { padding: 5px 10px; font-size: 12px; color: var(--dim); display: flex; align-items: center; justify-content: flex-end; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ktrack { position: relative; min-height: 36px; cursor: copy; }
.kscale .ktrack { height: 22px; min-height: 22px; cursor: default; }
.kscale .tick { position: absolute; top: 3px; transform: translateX(-50%); font-size: 11px; color: var(--dim); }
.ktrack .kline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .6; }
.ktrack.over { background: var(--accent-soft); }
.ksec { padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); border-top: 1px solid var(--line); }
.kbar { position: absolute; height: 26px; border-radius: 6px; padding: 0 6px; font-size: 11.5px; line-height: 26px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.kbar.run { background: var(--accent); }
.kbar.run.nodriver { background: repeating-linear-gradient(45deg, #64748b, #64748b 6px, #7c8aa0 6px, #7c8aa0 12px) !important; }
.kbar.work { opacity: .9; border: 1px dashed rgba(255,255,255,.7); }
.kbar:hover { filter: brightness(1.1); z-index: 2; }
.knone { background: var(--warn-bg); }
tr.off td { opacity: .55; }

/* ---------------------------------------------------------------- 運行状況（第 6 段） */
.unko { display: grid; grid-template-columns: minmax(0, 1fr) 640px; height: 100%; }
#umap { min-height: 0; }
.uside { display: flex; flex-direction: column; min-height: 0; overflow: auto; background: var(--panel); border-left: 1px solid var(--line); }
.ulist { padding: 10px 12px; display: grid; gap: 10px; }
.ucar { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.ucar.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ucar-h { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.ucar-h .link { margin-left: auto; }
.udev { padding: 10px 12px 30px; border-top: 1px solid var(--line); }
.udev h3 { margin: 4px 0; }
.tag.run-on { background: var(--accent-soft); color: var(--accent-strong); }
.warn { color: var(--warn); }
.vpin { display: inline-block; white-space: nowrap; padding: 3px 8px; border-radius: 14px; background: #1f6fb2; color: #fff; font-weight: 700; font-size: 12.5px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.vpin.old { background: #64748b; }
.bigcode { font-size: 44px; font-weight: 800; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); font-variant-numeric: tabular-nums; margin: 8px 0; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.ucar table { width: 100%; }
.ucar td:nth-child(-n+4) { white-space: nowrap; }

/* 集計（第 8 段） */
.stats-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; }
#stmap { height: 300px; border-radius: 10px; margin-bottom: 8px; }
@media (max-width: 900px) { .stats-two { grid-template-columns: 1fr; } }
.st-page .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
