* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1d1d1f; }
body { display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 10px 14px; background: #e9e9ee; }
button.primary { background: #c8102e; color: #fff; font-weight: 600; }
button.green { background: #1a7f37; color: #fff; font-weight: 600; }
button:disabled { opacity: .5; }
input, select { font: inherit; padding: 9px 10px; border: 1px solid #ccc; border-radius: 8px; width: 100%; }
label { font-size: 14px; font-weight: 600; display: block; margin: 12px 0 4px; }
.demo-banner { background: #fff3b0; color: #5c4a00; font-size: 13px; padding: 6px 10px; text-align: center; }
.emoji-pin { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.35); border: 3px solid #c8102e; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.card { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; }
.card h2 { margin: 0 0 4px; }
.muted { color: #666; font-size: 14px; }
.err { color: #c8102e; font-size: 14px; min-height: 1em; }
.hidden { display: none !important; }

/* ---------- public map ---------- */
.pub-header { background: #c8102e; color: #fff; padding: 12px 16px; }
.pub-header h1 { margin: 0; font-size: 20px; }
.pub-status { font-size: 15px; margin-top: 4px; opacity: .95; }
#map { flex: 1; }
.fab { position: absolute; right: 12px; bottom: 24px; z-index: 1000; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* ---------- driver ---------- */
.banner { background: #14532d; color: #fff; padding: 12px 14px; display: flex; gap: 14px; align-items: center; min-height: 110px; }
.banner.off { background: #b91c1c; }
.banner .arrow { font-size: 64px; line-height: 1; width: 72px; text-align: center; }
.banner .dist { font-size: 34px; font-weight: 800; }
.banner .text { font-size: 22px; font-weight: 600; line-height: 1.2; }
.then { background: #0f3d21; color: #d1fae5; font-size: 16px; padding: 6px 14px; }
.drive-bar { display: flex; gap: 8px; padding: 8px; background: #f4f4f6; align-items: center; flex-wrap: wrap; }
.drive-bar .stat { font-size: 14px; flex: 1; min-width: 140px; }
.progress { height: 6px; background: #ddd; }
.progress > div { height: 100%; width: 0; background: #c8102e; transition: width .5s; }
.icons { display: flex; gap: 8px; }
.icons button { font-size: 28px; padding: 6px 10px; background: #f2f2f5; border: 2px solid transparent; }
.icons button.sel { border-color: #c8102e; background: #fff; }

/* ---------- planner ---------- */
.plan { display: flex; flex: 1; min-height: 0; }
.side { width: 380px; max-width: 45vw; overflow: auto; padding: 14px; border-right: 1px solid #ddd; }
.side h1 { font-size: 20px; margin: 0 0 4px; }
.wp { display: flex; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eee; }
.wp .num { background: #c8102e; color: #fff; border-radius: 50%; width: 24px; height: 24px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.wp input[type=text] { padding: 5px 7px; font-size: 14px; }
.wp button { padding: 4px 8px; font-size: 13px; }
.wp .stopchk { font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 3px; margin: 0; font-weight: 400; }
.wp .stopchk input { width: auto; }
.steps { font-size: 14px; }
.steps div { padding: 5px 0; border-bottom: 1px solid #f0f0f0; display: flex; gap: 8px; }
.steps .a { width: 22px; text-align: center; }
.num-pin { background: #c8102e; color: #fff; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.num-pin.stop { background: #1a7f37; }
.dir-arrow { width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.dir-arrow::before { content: ""; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #fff; filter: drop-shadow(0 0 1px rgba(0,0,0,.6)); }
.mid-pin { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #2563eb; box-shadow: 0 1px 3px rgba(0,0,0,.4); cursor: grab; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row > * { flex: 1; }
@media (max-width: 700px) { .plan { flex-direction: column-reverse; } .side { width: 100%; max-width: none; height: 50vh; border-right: 0; } }

/* ---------- accounts: login, my account, manage ---------- */
a { color: #b00d27; }
a.btn { display: inline-block; text-decoration: none; color: inherit; border-radius: 10px; padding: 10px 14px; background: #e9e9ee; text-align: center; }
a.btn.primary { background: #c8102e; color: #fff; font-weight: 600; }
a.btn.green { background: #1a7f37; color: #fff; font-weight: 600; }
button.small, a.btn.small { padding: 5px 10px; font-size: 13px; }
button.wide { width: 100%; margin-top: 14px; }
button.linkish { background: none; padding: 4px 0; color: #b00d27; font-size: 14px; text-decoration: underline; }
.linkrow { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.ok { color: #1a7f37; font-size: 14px; min-height: 1em; margin-top: 8px; }
.note { background: #f4f4f6; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.tag { background: #e9e9ee; border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.nowrap { white-space: nowrap; }

.auth-page { background: #c8102e; }
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.auth-wrap .card { box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.tabs { display: flex; gap: 4px; background: #f0f0f3; border-radius: 12px; padding: 4px; margin-bottom: 4px; }
.tabs button { flex: 1; background: none; padding: 8px; }
.tabs button.sel { background: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: #c8102e; color: #fff; padding: 10px 16px; }
.topbar a { color: #fff; }
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar .who { font-size: 14px; }
.topbar button { background: rgba(255,255,255,.2); color: #fff; }
.page { flex: 1; overflow: auto; padding: 16px; width: 100%; max-width: 880px; margin: 0 auto; }
.page h2 { font-size: 19px; margin: 18px 0 10px; }
.page h3 { font-size: 16px; margin: 16px 0 6px; }
.panel { background: #fff; border: 1px solid #e3e3e8; border-radius: 14px; padding: 4px 16px 16px; margin-bottom: 16px; }
.dept { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid #e3e3e8; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.dept-name { font-weight: 700; font-size: 17px; }
.dept-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.slugrow { display: flex; align-items: center; gap: 4px; }
.slugrow span { white-space: nowrap; }
table.people { width: 100%; border-collapse: collapse; font-size: 14px; }
table.people th { text-align: left; font-size: 13px; color: #666; font-weight: 600; padding: 6px 4px; border-bottom: 1px solid #e3e3e8; }
table.people td { padding: 8px 4px; border-bottom: 1px solid #f0f0f3; vertical-align: middle; }
table.people select { width: auto; padding: 5px 8px; }
.linkline { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #f0f0f3; }
.copybox { display: flex; gap: 6px; flex: 1; min-width: 260px; max-width: 460px; }
.copybox input { font-size: 13px; padding: 6px 8px; background: #fafafa; }
#miniMap { height: 260px; border-radius: 10px; margin-top: 8px; border: 1px solid #ddd; }
.signedin { font-size: 13px; color: #666; margin-top: 12px; line-height: 1.5; }
.staff-link { position: absolute; left: 12px; bottom: 30px; z-index: 1000; font-size: 12px; color: #666; background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 8px; text-decoration: none; }

/* ---------- multiple routes ---------- */
.pub-sub { font-size: 14px; margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub-sub button { background: rgba(255,255,255,.22); color: #fff; }
.sched-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.sched-list button { text-align: left; background: #f4f4f6; border: 2px solid transparent; line-height: 1.35; }
.sched-list button.sel { border-color: #c8102e; background: #fff; }
.sched-list button.past { opacity: .55; }
.plan-cards { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.plan-card { flex: 1; min-width: 200px; border: 2px solid #e3e3e8; border-radius: 12px; padding: 10px 12px; }
.plan-card.cur { border-color: #1a7f37; }
.plan-card .price { font-size: 22px; font-weight: 800; }

/* ---------- paper-map reader ---------- */
details.mapread { border: 2px dashed #c8102e; border-radius: 12px; padding: 8px 12px; margin: 12px 0 4px; background: #fff7f8; }
details.mapread summary { cursor: pointer; font-weight: 700; }
details.mapread input[type=file] { margin: 10px 0 6px; }
.mr-pages { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.mr-page { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; cursor: pointer; }
.mr-page img { width: 84px; border: 1px solid #ddd; border-radius: 6px; background: #fff; }
.mr-result { border-top: 1px solid #f0d4d9; padding: 8px 0; margin-top: 6px; font-size: 14px; }
.mr-route { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; }
#mrReport ul { margin: 4px 0; padding-left: 20px; }
.mr-combine { background: #fff; border: 1px solid #f0d4d9; border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.mr-combine button { display: block; width: 100%; margin-top: 8px; }
.mr-route { border-top: 1px solid #f0d4d9; align-items: flex-start; }
.mr-route.off { opacity: .55; }
.mr-route input[type=checkbox] { width: auto; margin-top: 4px; }
.mr-route-main { flex: 1; font-size: 14px; }
.mr-route-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
