:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #5d6877;
  --line: #dde2e9;
  --accent: #1a73e8;
  --accent-text: #ffffff;
  --danger: #c5221f;
  --ok: #188038;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --panel: #1b212a;
    --text: #e8ecf2;
    --muted: #9aa5b4;
    --line: #2d3644;
    --accent: #6ea8fe;
    --accent-text: #0b1220;
    --danger: #ff8a80;
    --ok: #81c995;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  font-size: 15px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 17px; margin: 0; }
.chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.layout { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
.panel {
  overflow-y: auto;
  padding: 12px 16px 32px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.map { min-height: 300px; background: #e5e9ef; }

h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
section { margin-bottom: 4px; }
.muted, .hint { color: var(--muted); font-size: 13px; }
.hint { margin: 6px 0 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 6px 0; }

button, .btn {
  font: inherit;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.row input { flex: 1; min-width: 0; }

.status { min-height: 1.3em; margin: 4px 0; font-size: 13px; color: var(--muted); }
.status[data-kind="error"] { color: var(--danger); }
.status[data-kind="ok"] { color: var(--ok); }

.points { list-style: none; padding: 0; margin: 0; }
.points li { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.points .badge, .pin {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.points input { flex: 1; min-width: 0; padding: 5px 8px; }
.points .label { flex: 1; }
.points .mini { padding: 2px 8px; }
.pin { border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: grab; }
.pin.start { background: #188038; color: #fff; }
.pin.end { background: #c5221f; color: #fff; }

.summary { font-weight: 600; margin: 8px 0 0; }
.links { display: flex; flex-direction: column; gap: 8px; }
.links .btn { text-align: center; padding: 12px; font-size: 16px; }
.saved { list-style: none; padding: 0; margin: 0; }
.saved li { padding: 4px 0; }
.saved button { width: 100%; text-align: left; }

.access { margin-top: 18px; font-size: 13px; color: var(--muted); }
.access summary { cursor: pointer; }

/* Role-based visibility */
body:not(.can-edit) .editor-only { display: none; }
body.can-edit .viewer-only { display: none; }

@media (max-width: 800px) {
  html, body { height: auto; }
  .layout { display: flex; flex-direction: column; }
  .map { order: -1; height: 55vh; flex: none; }
  .panel { overflow: visible; border-right: 0; border-top: 1px solid var(--line); }
}
