/* 配車・注文管理 */
:root {
  --bg: #f4f3ef;
  --paper: #ffffff;
  --ink: #1b1f27;
  --ink2: #4a5160;
  --muted: #7b8291;
  --line: #e2e0d9;
  --line2: #eeece6;
  --accent: #0e6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ed;
  --red: #c2410c;
  --red-soft: #fdeee6;
  --amber: #a16207;
  --amber-soft: #fdf4d8;
  --blue: #1d4ed8;
  --blue-soft: #e5ecfd;
  --green: #15803d;
  --green-soft: #e3f4e8;
  --gray-soft: #eceae4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 32, .06), 0 4px 16px rgba(20, 24, 32, .05);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Microsoft YaHei", "PingFang SC", "Noto Sans JP", "Noto Sans SC", system-ui, sans-serif;
  --num: "SF Mono", "Consolas", "Menlo", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.neg { color: var(--red) !important; }
.loading, .empty { padding: 48px 16px; text-align: center; color: var(--muted); }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px; background: var(--ink); color: #f3f1ea;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; letter-spacing: .02em; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); font-size: 16px; }
.tabs { display: flex; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; color: #b9bcc5; padding: 0 14px; cursor: pointer; white-space: nowrap;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent; font-weight: 600;
}
.tabs button:hover { color: #fff; }
.tabs button.on { color: #fff; border-bottom-color: #4fd1b5; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.lang { display: inline-flex; border: 1px solid #3b414e; border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: none; color: #b9bcc5; padding: 4px 11px; cursor: pointer; font-size: 12px; }
.lang button.on { background: #f3f1ea; color: var(--ink); font-weight: 700; }
.who { color: #b9bcc5; font-size: 13px; }
.top .link { color: #b9bcc5; }

/* ---------- common controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: #c9c6bc; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.wide { width: 100%; height: 42px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon { border: 0; background: none; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; font-size: 18px; line-height: 1; color: var(--ink2); }
.icon:hover { background: var(--gray-soft); }
.icon.del { font-size: 13px; width: 26px; height: 26px; color: var(--muted); }
.link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); font-size: 13px; }
input, select, textarea {
  height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 0 9px; min-width: 0;
}
::placeholder { color: #b5b8bf; }
textarea { height: auto; padding: 7px 9px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14, 107, 92, .25); border-color: var(--accent); }
.chk { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; color: var(--ink2); }
.chk input { width: 16px; height: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 12px; font-size: 15px; }

#app { max-width: 1480px; margin: 0 auto; padding: 16px 20px 80px; }

/* ---------- bar / filters ---------- */
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bar .h { font-size: 20px; margin: 0; }
.bar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.monthnav { display: flex; align-items: center; gap: 4px; }
.monthnav strong { font-size: 20px; min-width: 120px; text-align: center; }
.monthnav strong.dow { min-width: 0; font-size: 16px; margin: 0 4px; }
.monthnav input[type=date] { font-weight: 700; }
.days { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 8px; scrollbar-width: thin; }
.day {
  flex: 0 0 auto; width: 40px; padding: 4px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.day.all { width: auto; padding: 4px 12px; }
.day span { font-weight: 700; }
.day small { font-size: 11px; color: var(--accent); min-height: 13px; font-weight: 700; }
.day.sun span { color: var(--red); }
.day.sat span { color: var(--blue); }
.day.today { border-color: var(--ink); }
.day.on { background: var(--ink); border-color: var(--ink); }
.day.on span, .day.on small { color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { flex: 0 1 auto; max-width: 200px; }
.hint { margin: -4px 0 12px; font-size: 13px; }

/* ---------- table ---------- */
.tbl-scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #faf9f6; position: sticky; top: 0; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #faf9f5; }
.tbl tfoot td { font-weight: 700; background: #faf9f6; border-bottom: 0; white-space: nowrap; }
.tbl .r, .tbl th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl td.wide { min-width: 220px; }
.tbl .time { font-family: var(--num); font-weight: 700; }
.tbl .no { font-family: var(--num); font-size: 12.5px; white-space: nowrap; }
.sub { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.plate { white-space: nowrap; }
.route { font-weight: 600; }
.miss { color: var(--red); font-weight: 700; }
.ext { display: inline-block; font-size: 12px; padding: 0 6px; border-radius: 4px; background: var(--blue-soft); color: var(--blue); font-weight: 700; }
tr.is-cancel td { color: var(--muted); text-decoration: line-through; }
tr.is-cancel td select { text-decoration: none; }
.warn { color: var(--amber); font-weight: 700; white-space: nowrap; cursor: help; }
td.w { width: 44px; }

.st, .ty { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; vertical-align: 1px; }
.st-pending { background: var(--red-soft); color: var(--red); }
.st-scheduled { background: var(--amber-soft); color: var(--amber); }
.st-dispatched { background: var(--blue-soft); color: var(--blue); }
.st-done { background: var(--green-soft); color: var(--green); }
.st-cancel { background: var(--gray-soft); color: var(--muted); }
.ty { background: var(--gray-soft); color: var(--ink2); }
.ty-arr { background: #e6f2fb; color: #075985; }
.ty-dep { background: #f3e8fd; color: #6b21a8; }
.ty-charter { background: #fff1db; color: #9a3412; }
select.st-sel { height: 28px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 0 8px; border-color: transparent; cursor: pointer; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; background: rgba(20, 24, 32, .38); opacity: 0; pointer-events: none; transition: opacity .18s; }
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(860px, 100%); background: var(--bg);
  display: flex; flex-direction: column; transform: translateX(24px); transition: transform .18s; box-shadow: -8px 0 32px rgba(0, 0, 0, .15);
}
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; font-family: var(--num); display: flex; align-items: center; gap: 10px; }
.drawer-head .icon { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px 20px; }
.drawer-foot { display: flex; gap: 8px; align-items: center; padding: 10px 20px; background: var(--paper); border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-foot .sp { flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin: 0 0 12px; padding: 10px 14px 14px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--accent); }
.grid { display: grid; gap: 10px 12px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fld > span { font-size: 12px; color: var(--ink2); font-weight: 600; }
.fld > span i { color: var(--red); font-style: normal; }
.fld input, .fld select, .fld textarea { width: 100%; }
.fld .help { color: var(--muted); font-size: 11px; line-height: 1.35; }
.fld.dim { opacity: .45; }
#orderForm.is-ext .m-int, #orderForm:not(.is-ext) .m-ext { opacity: .55; }
.meta { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.warnlist { list-style: none; margin: 0 0 12px; padding: 10px 14px; background: var(--amber-soft); border: 1px solid #f1dc9c; border-radius: var(--radius); color: #7a4a06; font-weight: 600; font-size: 13px; }
.warnlist li + li { margin-top: 2px; }
.calc { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.calc > div { background: #faf9f6; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.calc span { font-size: 11.5px; color: var(--muted); }
.calc b { font-size: 17px; font-variant-numeric: tabular-nums; }
.calc .hl { background: var(--accent-soft); border-color: #bfe0d7; }
.calc .hl b { color: var(--accent); }
.calc .hl.neg { background: var(--red-soft); border-color: #f5c8b2; }
.calc .hl.neg b { color: var(--red); }
.calc .settle { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.calc .settle small { color: var(--muted); font-size: 11px; flex-basis: 100%; }

/* ---------- board ---------- */
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.lane { background: #ebe9e2; border-radius: var(--radius); padding: 10px; min-height: 80px; }
.lane.un { background: var(--red-soft); }
.lane.ext { background: var(--blue-soft); }
.lane h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.lane h3 small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.lane h3 em { margin-left: auto; font-style: normal; font-size: 12px; background: rgba(0, 0, 0, .07); border-radius: 999px; padding: 0 8px; }
.job { background: var(--paper); border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; box-shadow: var(--shadow); border-left: 4px solid var(--line); }
.job.st-b-pending { border-left-color: var(--red); }
.job.st-b-scheduled { border-left-color: #e0a40b; }
.job.st-b-dispatched { border-left-color: var(--blue); }
.job.st-b-done { border-left-color: var(--green); opacity: .75; }
.job header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.job .time { font-family: var(--num); font-weight: 800; font-size: 16px; margin-right: 2px; }
.job .warn { margin-left: auto; }
.job .route { cursor: pointer; line-height: 1.4; }
.job .route:hover { text-decoration: underline; }
.job .sub { margin-top: 2px; }
.job .assign { display: flex; align-items: center; gap: 4px 8px; margin-top: 8px; flex-wrap: wrap; }
.job .assign select { height: 30px; flex: 0 0 auto; min-width: 110px; font-weight: 700; }
.job .assign small { color: var(--muted); font-size: 12px; }
.job footer { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.idle { margin-top: 16px; font-size: 13px; color: var(--ink2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.idle span { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }
.print-only { display: none; }

/* ---------- summary ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 6px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi b { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi.hl { background: var(--accent-soft); border-color: #bfe0d7; }
.kpi.hl b { color: var(--accent); }
.sum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.sum-grid .card { padding: 14px; }
.sum-grid .tbl-scroll { box-shadow: none; }
.tbl.sum tbody tr { cursor: default; }
.barcell { position: relative; min-width: 140px; }
.barcell i { position: absolute; left: 6px; top: 7px; bottom: 7px; background: var(--accent-soft); border-radius: 3px; max-width: calc(100% - 12px); }
.barcell span { position: relative; }

/* ---------- settings ---------- */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.set-grid .span-all { grid-column: 1 / -1; }
.ed { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.ed th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 4px; }
.ed td { padding: 3px 4px; }
.ed td input:not([type=checkbox]), .ed td select { width: 100%; height: 32px; }
.ed td.c { text-align: center; width: 1%; }
.ed input[type=checkbox] { width: 18px; height: 18px; }
.nowrap { white-space: nowrap; }

/* ---------- auth ---------- */
.auth { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.auth-card h1 { font-size: 18px; margin: 0; }
.auth-card p { margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.auth-card input { height: 40px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 80; opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); transition: all .18s; font-weight: 600;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--accent); }
.toast button { border: 1px solid rgba(255, 255, 255, .6); background: none; color: #fff; border-radius: 6px; padding: 2px 10px; cursor: pointer; font-weight: 700; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sum-grid, .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; height: auto; padding: 8px 16px 0; gap: 8px; }
  .brand { order: 1; }
  .top-right { order: 2; gap: 8px; }
  .who { display: none; }
  .tabs { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 8px; height: 42px; }
  .tabs button { flex: 1; padding: 0 8px; }
  #app { padding: 12px 16px 80px; }
  .monthnav strong { font-size: 17px; min-width: 100px; }
  .bar-actions { margin-left: 0; width: 100%; }
  .bar-actions .btn { flex: 1 1 auto; padding: 0 8px; font-size: 13px; }
  .filters select { flex: 1 1 40%; max-width: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 18px; }

  /* table -> cards */
  .tbl-scroll { background: none; border: 0; box-shadow: none; overflow: visible; }
  .tbl:not(.sum) thead { display: none; }
  .tbl:not(.sum), .tbl:not(.sum) tbody, .tbl:not(.sum) tfoot { display: block; }
  .tbl:not(.sum) tbody tr {
    display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; background: var(--paper); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
  }
  .tbl:not(.sum) tbody td { border: 0; padding: 0; min-width: 0 !important; }
  .tbl:not(.sum) tbody td:nth-child(1) { grid-column: 1; }
  .tbl:not(.sum) tbody td:nth-child(7) { grid-column: 2; grid-row: 1; }
  .tbl:not(.sum) tbody td:nth-child(2), .tbl:not(.sum) tbody td:nth-child(3), .tbl:not(.sum) tbody td:nth-child(4) { display: inline; }
  .tbl:not(.sum) tbody td:nth-child(5), .tbl:not(.sum) tbody td:nth-child(6) { grid-column: 1 / -1; }
  .tbl:not(.sum) tbody td:nth-child(2) .sub, .tbl:not(.sum) tbody td:nth-child(4) .sub { display: inline; margin-left: 4px; }
  .tbl:not(.sum) tbody td.r { text-align: left; font-size: 12.5px; }
  .tbl:not(.sum) tbody td.r::before { content: attr(data-l) " "; color: var(--muted); font-size: 11.5px; }
  .tbl:not(.sum) tbody td.w { grid-column: 2; text-align: right; width: auto; }
  .tbl:not(.sum) tfoot tr { display: block; background: var(--paper); border-radius: var(--radius); padding: 10px 12px; border: 1px solid var(--line); }
  .tbl:not(.sum) tfoot td { display: inline-block; background: none; padding: 0 8px 0 0; white-space: normal; }

  .drawer-panel { width: 100%; }
  .drawer-body { padding: 10px 12px 16px; }
  .drawer-head, .drawer-foot { padding: 10px 12px; }
  .drawer-foot .btn { flex: 1 1 auto; }
  .drawer-foot .sp { display: none; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: 1 / -1; }
  .lanes { grid-template-columns: 1fr; }
  .ed { display: block; overflow-x: auto; }
  .ed td input:not([type=checkbox]), .ed td select { min-width: 110px; }
}

/* ---------- print（配車表） ---------- */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .top, .bar, .hint, .drawer, .toast, .job footer, .idle { display: none !important; }
  #app { padding: 0; max-width: none; }
  .print-only { display: block; font-size: 16px; margin: 0 0 8px; }
  .lanes { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .lane { background: #fff !important; border: 1px solid #999; break-inside: avoid; padding: 6px; }
  .job { box-shadow: none; border: 1px solid #ccc; border-left-width: 3px; break-inside: avoid; margin-bottom: 4px; padding: 5px 6px; }
  .job .assign select { border: 0; padding: 0; appearance: none; -webkit-appearance: none; height: auto; }
}

/* 工資 */
.payinfo { font-size: 11.5px; color: var(--ink2); line-height: 1.5; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; margin-right: 2px; }
.tag.auto { background: var(--accent-soft); color: var(--accent); }
.tag.man { background: var(--blue-soft); color: var(--blue); }
.tag.ng { background: var(--amber-soft); color: var(--amber); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.ed-payRoutes td input { text-align: right; }
.ed-payRoutes td:first-child input { text-align: left; }
.card h2 select { margin-left: 8px; height: 30px; font-size: 13px; font-weight: 600; }
.sum-grid .span-all { grid-column: 1 / -1; }

/* 貼り付け入力 */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(20, 24, 32, .38); display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-panel { width: min(640px, 100%); display: flex; flex-direction: column; gap: 10px; }
.modal-head { display: flex; align-items: center; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-panel p { margin: 0; }
.modal-panel .fld { max-width: 200px; }
.modal-panel textarea { width: 100%; font-size: 13px; line-height: 1.55; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* 自動配車 */
.btn.accent { background: #fff7e6; border-color: #f0c674; color: #8a5a00; }
.modal-panel.wide { width: min(980px, 100%); }
.auto-date { font-size: 14px; }
.auto-drv { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 12px; background: #faf9f6; border: 1px solid var(--line2); border-radius: 8px; }
.auto-drv small { color: var(--muted); }
#autoResult { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow-y: auto; }
.plan { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; }
.plan.left { background: var(--red-soft); border-color: #f5c8b2; }
.plan-h { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13px; }
.plan-h b:first-child { font-size: 15px; }
.plan-h .plate { color: var(--ink2); }
.plan ol { margin: 6px 0 2px; padding-left: 22px; font-size: 13px; }
.plan li { margin: 2px 0; }
.plan li .time { font-family: var(--num); font-weight: 700; margin-right: 6px; }
.lane h3 .link { font-size: 14px; }

/* 勤務表 */
.roster-wrap { max-height: calc(100vh - 230px); overflow: auto; }
.roster { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.roster th, .roster td { border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); text-align: center; padding: 0; height: 34px; min-width: 34px; }
.roster thead th { position: sticky; top: 0; z-index: 2; background: #faf9f6; font-weight: 700; line-height: 1.1; padding: 4px 0; }
.roster thead th small { display: block; font-weight: 500; color: var(--muted); font-size: 10.5px; }
.roster thead th.sun { color: var(--red); } .roster thead th.sat { color: var(--blue); }
.roster thead th.today { background: var(--ink); color: #fff; }
.roster th.nm { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 0 10px; min-width: 96px; white-space: nowrap; }
.roster thead th.nm { z-index: 3; background: #faf9f6; }
.roster th.nm small { display: block; font-weight: 500; color: var(--muted); font-size: 10.5px; }
.roster td[data-n] { cursor: pointer; user-select: none; }
.roster td.on:hover { background: var(--accent-soft); }
.roster td.has { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.roster td.off { background: #fde2d6; color: var(--red); font-weight: 700; }
.roster td.off.wk { background: #f3efe6; color: #a08c6a; }
.roster td.off.bad { background: var(--red); color: #fff; }
.roster td.busy { opacity: .4; }
.roster td.sum { font-weight: 700; padding: 0 8px; }
.roster tfoot td, .roster tfoot th { background: #faf9f6; font-weight: 700; }
.roster tfoot td.short { background: var(--amber-soft); color: var(--amber); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; color: var(--ink2); margin: -4px 0 10px; }
.legend .lg { display: inline-grid; place-items: center; min-width: 24px; height: 20px; border-radius: 4px; border: 1px solid var(--line); font-weight: 700; margin-left: 8px; font-size: 11px; }
.lg.on { background: #fff; } .lg.has { background: var(--accent-soft); color: var(--accent); }
.lg.off { background: #fde2d6; color: var(--red); } .lg.off.wk { background: #f3efe6; color: #a08c6a; } .lg.off.bad { background: var(--red); color: #fff; }
.lg.short { background: var(--amber-soft); color: var(--amber); }
.idle.offs span { background: #fde2d6; border-color: #f5c8b2; }
.chk.is-off { color: var(--muted); }
@media print { .roster-wrap { max-height: none; overflow: visible; } .legend { display: none; } }

/* 外注 */
.auto-drv.ext { background: var(--blue-soft); border-color: #c9d6fb; margin-top: 6px; }
.auto-drv .fb { margin-left: auto; font-size: 13px; }
.auto-drv .fb select { height: 30px; }
.auto-drv small { margin-left: 2px; }
.auto-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 12px; background: #faf9f6; border-radius: 8px; font-size: 13px; }
.auto-sum b { font-size: 16px; }
.auto-h { margin: 6px 0 0; font-size: 14px; color: var(--blue); }
.plan.ext { border-color: #c9d6fb; background: #f7f9ff; }
.tag.ext { background: var(--blue-soft); color: var(--blue); }
.roster tr.ext th.nm { color: var(--blue); }
.roster tr.sep th, .roster tr.sep td { background: var(--blue-soft); color: var(--blue); font-weight: 700; height: 26px; }

/* 配車案の手直し */
.plan-h select { height: 30px; font-size: 13px; max-width: 260px; }
.plan-h .pe-drv { font-weight: 700; }
.pe-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; }
.pe-why { font-size: 12px; color: var(--ink2); margin-top: 4px; }
.pe-iss { list-style: none; margin: 4px 0 0; padding: 4px 10px; background: var(--amber-soft); border-radius: 6px; color: #7a4a06; font-size: 12.5px; font-weight: 600; }
.plan.has-issue { border-color: #f1dc9c; }
.plan li .pe-move { height: 24px; font-size: 11.5px; padding: 0 4px; margin-left: 4px; color: var(--ink2); border-color: var(--line2); }
#peAdd { align-self: flex-start; }
