:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7a;
  --border: #d8dee6;
  --accent: #1d5fbf;
  --club: #d9480f;
  --ddb: #1d5fbf;
  --anonymous: #6c7a89;
  --error: #b42318;
  --warning: #9a6700;
  --ok: #1a7f37;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --surface: #1a2129;
    --text: #e6ebf0;
    --muted: #9aa7b4;
    --border: #2d3843;
    --accent: #6ea8fe;
    --ddb: #6ea8fe;
    --anonymous: #9aa7b4;
    --error: #ff8a80;
    --warning: #e3b341;
    --ok: #56d364;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: .9rem; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; }
.logout { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.who { color: var(--muted); font-size: .9em; }

.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem; flex: 1; }
.footer { padding: .5rem 1rem; color: var(--muted); font-size: .85em; text-align: center; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem 1.25rem; margin: 1rem 0;
}
.narrow { max-width: 420px; margin: 3rem auto; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, button { font: inherit; }
input:not([type=checkbox]), select {
  padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); width: 100%;
}
button {
  padding: .5rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff;
  cursor: pointer; align-self: flex-start;
}
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
button.danger { color: var(--error); }

.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table.settings td:nth-child(2) { width: 9rem; }
.actions { white-space: nowrap; display: flex; gap: .75rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9em; margin: 0; }
.error { color: var(--error); }
.warning { color: var(--warning); font-size: .9em; }
.ok { color: var(--ok); }
code { font-size: .95em; }

/* Live map */
body.full { height: 100vh; overflow: hidden; }
.map-page { position: relative; flex: 1; }
#map { position: absolute; inset: 0; }
.map-status, .legend {
  position: absolute; z-index: 2; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: .3rem .6rem; font-size: .85em;
}
.map-status { top: .6rem; left: .6rem; }
.legend { bottom: 2.2rem; left: .6rem; display: flex; gap: .8rem; flex-wrap: wrap; max-width: calc(100% - 1.2rem); }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; }
.dot.club { background: var(--club); }
.dot.ddb { background: var(--ddb); }
.dot.anonymous { background: var(--anonymous); }
.maplibregl-popup-content { color: #1c2430; font-size: .9em; }
.popup-title { font-weight: 700; margin-bottom: .2rem; }
