:root { --bg: #f4f6f8; --card: #fff; --text: #1d2733; --muted: #5b6b7b; --line: #d8dee4; --accent: #1f4e79; --warn-bg: #fff4e0; --warn: #8a5a00; --bad: #b3261e; --ok-bg: #e7f5ec; --err-bg: #fdeceb; }
@media (prefers-color-scheme: dark) { :root { --bg: #14181d; --card: #1e242b; --text: #e8edf2; --muted: #9aa8b6; --line: #34404c; --accent: #6aa7dc; --warn-bg: #3a2d12; --warn: #f0c06a; --bad: #ff8a80; --ok-bg: #16301f; --err-bg: #3b1a18; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; padding-bottom: env(safe-area-inset-bottom); }
header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: var(--accent); color: #fff; flex-wrap: wrap; }
.title { font-weight: 700; } .dev { font-size: 12px; font-weight: 400; background: rgba(255,255,255,.2); padding: 1px 8px; border-radius: 10px; margin-left: 6px; }
.who { font-size: 14px; } .link { background: none; border: 0; color: inherit; text-decoration: underline; font: inherit; cursor: pointer; margin-left: 8px; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 40px; }
nav#tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 2; }
nav#tabs button { flex: 0 0 auto; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 22px; font: inherit; cursor: pointer; }
nav#tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
h2, h3 { margin: 0 0 8px; font-size: 18px; } h3 { font-size: 16px; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
input, select, button { font: inherit; }
input[type=text], input[type=number], input[type=datetime-local], input[type=date], input[type=time], select { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; padding: 6px 12px 10px; } legend { font-size: 14px; color: var(--muted); padding: 0 6px; }
label.radio { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; min-height: 44px; color: var(--text); font-size: 16px; } label.radio input { width: 22px; height: 22px; }
button.primary { width: 100%; min-height: 48px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; margin-top: 8px; } button.primary:disabled { opacity: .5; }
.seg { display: flex; gap: 6px; margin: 8px 0; } .seg button { flex: 1; min-height: 44px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; cursor: pointer; } .seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.note, .hint { font-size: 13px; color: var(--muted); } .hint { min-height: 20px; }
.msg { padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; } .msg.ok { background: var(--ok-bg); } .msg.err { background: var(--err-bg); color: var(--bad); }
.warn { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.scroll { overflow-x: auto; } table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 6px 0 12px; } th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; } th { color: var(--muted); font-weight: 600; } td.r { text-align: right; } td.empty, p.empty { color: var(--muted); text-align: center; }
tr.bad td { color: var(--bad); } tr.q-incomplete td, tr.q-incalculable td { color: var(--muted); } tr.s-overdue td { color: var(--bad); font-weight: 700; } tr.s-due td { color: var(--warn); }
.flag { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; } .tag { font-size: 12px; background: var(--warn-bg); color: var(--warn); padding: 1px 8px; border-radius: 10px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; } .row select, .row input { flex: 1 1 140px; width: auto; } .row button { min-height: 44px; padding: 0 14px; border: 1px solid var(--accent); background: var(--card); color: var(--accent); border-radius: 8px; cursor: pointer; }
details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); }
@media (min-width: 640px) { main { padding-top: 20px; } }
.row2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); } .row2.s-overdue { color: var(--bad); font-weight: 700; } .row2.s-due { color: var(--warn); }
tr.clk { cursor: pointer; } tr.clk:hover td { background: var(--bg); } .cbtn { min-height: 36px; padding: 0 10px; border: 1px solid var(--accent); background: var(--card); color: var(--accent); border-radius: 8px; cursor: pointer; } button.ok, button.ng { min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--card); color: var(--accent); cursor: pointer; } button.ok { background: var(--accent); color: #fff; }
.codebig { font-family: ui-monospace, Consolas, monospace; font-size: 22px; letter-spacing: 2px; user-select: all; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; } .tile { min-height: 84px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); text-align: left; cursor: pointer; font: inherit; } .tile b { display: block; font-size: 16px; } .tile span { font-size: 12px; color: var(--muted); } .tile:disabled { opacity: .5; cursor: default; }
.attstat { font-size: 18px; margin-bottom: 8px; } .attstat b { font-size: 26px; display: block; } .bigbtn { width: 100%; min-height: 96px; font-size: 28px; font-weight: 700; border: 0; border-radius: 16px; background: var(--accent); color: #fff; cursor: pointer; margin: 8px 0; } .bigbtn.working { background: #b3502a; } .bigbtn.on_break, .bigbtn.on_gap { background: #2a7d4f; } .bigbtn:disabled { opacity: .5; } .chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; } .chip { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; } .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
[hidden] { display: none !important; }

/* ---- スマホ（iPhone・Android）：下部の固定メニュー・大きなボタン・横スクロールなし ---- */
html, body { max-width: 100%; overflow-x: hidden; }
main { width: 100%; min-width: 0; }
.card { max-width: 100%; overflow-x: auto; }
input, select, textarea { max-width: 100%; }
.backbtn { display: block; min-height: 44px; margin: 4px 0 8px; padding: 0 14px; border: 1px solid var(--line); background: var(--card); color: var(--accent); border-radius: 22px; font: inherit; cursor: pointer; }
.link2 { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.grid.big { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid.big .tile { min-height: 108px; padding: 14px; } .grid.big .tile b { font-size: 18px; }
.tile.wide { grid-column: 1 / -1; min-height: 64px; }
.homeatt .bigbtn { min-height: 88px; }
#bottomNav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#bottomNav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 6px 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
#bottomNav button i { font-style: normal; font-size: 22px; line-height: 1; }
#bottomNav button.on { color: var(--accent); font-weight: 700; }
#bottomNav em { position: absolute; top: 8px; left: calc(50% + 8px); width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
body.kbd #bottomNav { display: none; }
@media (max-width: 767px) {
  nav#tabs { display: none; }
  main#app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  header { padding: 8px 12px; } .who { font-size: 13px; }
}
@media (min-width: 768px) {
  #bottomNav { display: none !important; }
  .backbtn { display: none; }
  main { max-width: 1100px; }
  nav#tabs { flex-wrap: wrap; overflow-x: visible; }
  .grid.big { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ---- 配車・売上 ---- */
.dpbar { align-items: center; } .dpbar input { flex: 1 1 140px; } .cbtn.add { background: var(--accent); color: #fff; }
.dcard { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.dcard .dtop { display: flex; justify-content: space-between; gap: 8px; } .dcard .dsub { font-size: 14px; color: var(--muted); } .dcard.cx { opacity: .55; text-decoration: line-through; }
#dpForm .row label { flex: 1 1 140px; }

/* ---- 配車・売上：一覧性・入力の速さ（PC は 2 列、スマホは 1 列）---- */
.daylabel { font-size: 15px; font-weight: 400; color: var(--muted); }
.dpbar .cbtn { min-height: 44px; } .dpbar input { min-height: 44px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.chips button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.chips button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.dcard .dtime { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tag.ok { background: var(--ok-bg); color: var(--text); }
.cbtn.big { min-height: 48px; flex: 1 1 140px; }
#dpForm .row .primary { flex: 1 1 140px; }
@media (min-width: 900px) {
  #tab-dispatch.tab:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 14px; align-items: start; }
  #tab-dispatch > .dpmain { grid-column: 1; grid-row: 1 / span 4; }
  #tab-dispatch > :not(.dpmain) { grid-column: 2; }
  #tab-dispatch > #dpForm { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow-y: auto; }
  main { max-width: 1300px; }
}