:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #17202a; --muted: #5b6673; --line: #dde1e6;
  --accent: #1a4c9c; --accent-text: #ffffff; --accent-soft: #e7eef9;
  --warn: #8a5a00; --warn-soft: #fff4dc; --bad: #a3262a; --bad-soft: #fde8e8; --ok: #1d6b3a; --ok-soft: #e3f4e8;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b; --panel: #1b2027; --text: #e7eaee; --muted: #9aa4b0; --line: #2e3540;
    --accent: #6f9ee8; --accent-text: #0d1420; --accent-soft: #1f2c40;
    --warn: #f0c060; --warn-soft: #3a2f16; --bad: #f08a8a; --bad-soft: #3d1f22; --ok: #7fd49a; --ok-soft: #1a3324;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b; --panel: #1b2027; --text: #e7eaee; --muted: #9aa4b0; --line: #2e3540;
  --accent: #6f9ee8; --accent-text: #0d1420; --accent-soft: #1f2c40;
  --warn: #f0c060; --warn-soft: #3a2f16; --bad: #f08a8a; --bad-soft: #3d1f22; --ok: #7fd49a; --ok-soft: #1a3324;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { padding: 20px 16px 8px; max-width: 1280px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0; }
main { max-width: 1280px; margin: 0 auto; padding: 8px 16px 40px; display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; margin-right: 8px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; margin: 4px 0 0; }
input[type=text], input[type=number], select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
input[type=file] { width: 100%; font: inherit; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-row label { font-weight: 400; margin: 4px 0; display: flex; gap: 6px; align-items: center; }
button { font: inherit; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 12px; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; width: 100%; padding: 11px; margin-top: 16px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { padding: 4px 9px; font-size: 13px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; padding: 28px 16px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--bg); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.loaded { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.dropzone.bad { border-style: solid; border-color: var(--bad); background: var(--bad-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-title { font-weight: 700; font-size: 16px; color: var(--accent); }
.dropzone.loaded .dz-title { color: var(--ok); }
.dropzone.bad .dz-title { color: var(--bad); }
.dz-sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.status { font-size: 14px; margin-top: 12px; color: var(--muted); min-height: 1.4em; }
.status.error { color: var(--bad); }
progress { width: 100%; height: 8px; margin-top: 8px; accent-color: var(--accent); }
#map { height: 520px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
@media (max-width: 900px) { #map { height: 380px; } }
.empty-map { display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--bg); border-radius: 8px; padding: 10px; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.route { border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; background: var(--panel); }
.route h3 { margin: 0 0 4px; font-size: 16px; }
.route .meta { color: var(--muted); font-size: 13px; }
/* Volunteer page (opened from a #r= link on a phone) */
body.v-mode header, body.v-mode main { display: none; }
#volunteer { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }
.v-head h1 { margin: 0; font-size: 22px; }
.v-head p { margin: 2px 0 8px; color: var(--muted); }
.v-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 12px; }
.v-bar span { display: block; height: 100%; background: var(--ok); transition: width .3s; }
#vmap { height: 36vh; min-height: 220px; border-radius: var(--radius); border: 1px solid var(--line); }
.v-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 12px; }
.v-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.v-big { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.v-big b { display: block; font-size: 19px; }
.v-big small { color: var(--muted); font-size: 14px; }
.v-big .v-num { width: 40px; height: 40px; font-size: 16px; }
.v-btn { display: block; width: 100%; box-sizing: border-box; text-align: center; border: 0; border-radius: 12px; padding: 15px; font: 700 17px system-ui, -apple-system, sans-serif; text-decoration: none; background: var(--accent); color: var(--accent-text); cursor: pointer; }
.v-btn + .v-btn { margin-top: 10px; }
.v-btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.v-card p { margin: 0 0 14px; }
.v-stops { list-style: none; padding: 0; margin: 18px 0 0; }
.v-stops button { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 6px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.v-stops .current button { background: var(--accent-soft); border-radius: 8px; }
.v-stops .done .v-addr { color: var(--muted); text-decoration: line-through; }
.v-stops .done .v-num { background: #8a939e; }
.v-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #d93025; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.v-addr { flex: 1; min-width: 0; }
.v-addr small { display: block; color: var(--muted); }
.pin { width: 30px; height: 30px; background: #d93025; border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 4px rgba(0,0,0,.45); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font: 700 12px system-ui, sans-serif; }
.pin.done { background: #8a939e; }
.pin.current { width: 40px; height: 40px; background: #b3141a; }
.pin.current span { font-size: 15px; }
.part-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 14px; }
.part-row input { width: 72px; }
.small-link { align-self: center; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.warn-text { color: var(--warn); }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 8px; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.num-icon { background: var(--c); color: #fff; border: 2px solid #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font: 700 11px system-ui, sans-serif; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.start-icon { background: #111; color: #fff; border: 2px solid #fff; border-radius: 6px; width: 26px; height: 26px; display: grid; place-items: center; font: 700 12px system-ui, sans-serif; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.link-btn { display: block; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; text-decoration: underline; cursor: pointer; }
.support { max-width: 1280px; margin: 0 auto; padding: 0 16px 28px; text-align: center; }
#volunteer .support { padding: 18px 0 0; }
.hidden { display: none !important; }
