:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel2: #f1f3f6;
  --text: #1d2733;
  --muted: #6b7684;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #e8f0fe;
  --good: #0e9f6e;
  --mid: #b45309;
  --bad: #dc2626;
  --border: #e4e8ee;
  --shadow: 0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.05);
  --shadow-lg: 0 4px 16px rgba(16,24,40,.09);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.9rem 1.4rem; background: var(--panel);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
h1 { font-size: 1.2rem; margin: 0; }
.tagline { color: var(--muted); }
main { max-width: 800px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; }
h2 { font-size: 1.05rem; margin: 1.8rem 0 0.6rem; }
h3 { margin: 0; font-size: 1.1rem; }
.lead { font-size: 1.02rem; color: #313d4b; }
.muted { color: var(--muted); font-size: 0.87rem; }

form {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.1rem 1.3rem 1.4rem; box-shadow: var(--shadow);
}
label { display: block; font-size: 0.92rem; font-weight: 500; }
input {
  width: 100%; margin-top: 0.25rem; padding: 0.55rem 0.7rem; font: inherit;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.13); }
.row { display: flex; gap: 0.9rem; align-items: end; }
.row .grow { flex: 1; }
.row label:not(.grow) { width: 9rem; }
@media (max-width: 600px) { .row { flex-direction: column; align-items: stretch; } .row label:not(.grow) { width: auto; } }

.prios { display: flex; flex-direction: column; gap: 0.7rem; }
.prio { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.prio-head { display: flex; flex-direction: column; min-width: 12rem; flex: 1; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.seg button {
  border: none; background: var(--panel); color: var(--muted);
  padding: 0.35rem 0.75rem; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

button.primary {
  margin-top: 1.2rem; background: var(--accent); border: 1px solid var(--accent);
  color: #fff; font: inherit; font-weight: 600; padding: 0.6rem 1.3rem;
  border-radius: 999px; cursor: pointer;
}
button.primary:hover { background: var(--accent-dark); }

#resbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
#resbar h2 { margin: 1.8rem 0 0.4rem; }
.viewtabs { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.viewtabs button {
  border: none; background: var(--panel); color: var(--muted);
  padding: 0.4rem 0.9rem; font: inherit; font-size: 0.88rem; cursor: pointer;
}
.viewtabs button + button { border-left: 1px solid var(--border); }
.viewtabs button.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

#map {
  height: 68vh; min-height: 380px; border-radius: 14px;
  border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 1;
}
#map[hidden], #cards[hidden], #legend[hidden], #resbar[hidden], #resfrom[hidden] { display: none; }
#legend { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin: 0.6rem 0 0; font-size: 0.82rem; }
#legend .key { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); }
#legend .key i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.work-pin { font-size: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.leaflet-popup-content { font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

.cards { display: flex; flex-direction: column; gap: 0.9rem; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.2rem; box-shadow: var(--shadow);
}
.card .top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.rank { color: var(--muted); font-weight: 600; margin-right: 0.35rem; }
.scorebox { text-align: right; line-height: 1.1; }
.scorebox strong { font-size: 1.35rem; color: var(--accent-dark); }
.scorebox span { display: block; font-size: 0.72rem; }
.card .meta { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0 0.5rem; }
.plus { color: #067a52; margin: 0.15rem 0; font-size: 0.9rem; }
.minus { color: #b91c1c; margin: 0.15rem 0; font-size: 0.9rem; }

.bars { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.7rem 0 0.4rem; }
.bar { display: grid; grid-template-columns: 9.5rem 1fr 2.2rem; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.bar em { font-style: normal; color: var(--muted); text-align: right; }
.track { background: var(--panel2); border-radius: 999px; height: 8px; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; }
.fill.good { background: var(--good); }
.fill.mid { background: var(--mid); }
.fill.bad { background: var(--bad); }
@media (max-width: 600px) { .bar { grid-template-columns: 7.5rem 1fr 2rem; font-size: 0.8rem; } }

details { margin-top: 0.4rem; }
summary { cursor: pointer; }
ul.raw { list-style: none; padding: 0.4rem 0 0; margin: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.3rem; font-size: 0.86rem; }
ul.raw li { display: flex; justify-content: space-between; gap: 0.5rem;
  border-bottom: 1px dotted var(--border); padding: 0.15rem 0; }

footer { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
footer a { color: var(--accent-dark); }
