:root {
  --bg: #0f1712;
  --panel: #18241c;
  --text: #eef5ef;
  --muted: #9bb0a1;
  --accent: #7dce7a;
  --danger: #e07474;
  --line: #2a3b30;
  --warn: #e0c36a;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #1d3a28 0%, transparent 40%),
    linear-gradient(180deg, #101912, var(--bg));
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent);
}
h1, h2 { margin: 0.15rem 0 0; font-weight: 700; }
main { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }
.panel, .course-card {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
}
.hidden { display: none !important; }
button, select {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #213528;
  color: var(--text);
  padding: 0.55rem 1rem;
  cursor: pointer;
}
button.primary { background: var(--accent); color: #102015; border-color: transparent; font-weight: 700; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.ghost { background: transparent; }
.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 5;
}
.library-tab {
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  pointer-events: auto;
}
.library-tab.active {
  background: var(--accent);
  color: #102015;
  border-color: transparent;
  font-weight: 700;
}
.badge.source-app { color: #9ec5ff; border-color: #3d6ea8; }
.badge.source-admin { color: #e0c36a; border-color: #8a7430; }
.badge.approved { color: var(--accent); }
.badge.rejected { color: var(--danger); }
label { display: grid; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.checkbox { display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.4rem; }
.filters {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(110px, 1fr)) auto auto;
  gap: 0.75rem 0.85rem;
  align-items: end;
  margin: 0.85rem 0 0.35rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 80%, black);
}
.filters .search-field { grid-column: 1 / -1; }
.filters .filter-dupes {
  padding-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.filters .filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  grid-column: 1 / -1;
}
@media (min-width: 900px) {
  .filters .search-field { grid-column: span 2; }
  .filters .filter-actions { grid-column: auto; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .filters .search-field,
  .filters .filter-actions {
    grid-column: 1 / -1;
  }
}
.hint { color: var(--muted); font-size: 0.9rem; }
.course-list { display: grid; gap: 0.85rem; }
.course-card { display: grid; gap: 0.75rem; }
.course-card header {
  padding: 0;
  border: 0;
  align-items: start;
}
.meta { color: var(--muted); font-size: 0.9rem; }
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
}
.badge.dup { color: var(--warn); border-color: var(--warn); }
.badge.pending { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  width: min(720px, 92vw);
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.dialog-body { margin: 0; padding: 1rem 1.25rem 1.25rem; }
.dialog-body header {
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--line);
}
#detail-json {
  max-height: 50vh;
  overflow: auto;
  background: #0c130e;
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.8rem;
}
.dialog-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
code { color: var(--accent); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}
.form-grid label,
label.full {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}
label.full { margin-bottom: 0.85rem; }
input, textarea, select {
  font: inherit;
  color: var(--text);
  background: #0c130e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  width: 100%;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
#add-course-dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  width: min(1100px, 96vw);
  max-height: 96vh;
  padding: 0;
  z-index: 1000;
}
#add-course-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  z-index: 999;
}
.editor-body {
  max-height: 96vh;
  overflow: auto;
}
.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.85rem;
}
.editor-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.85rem;
  min-height: 420px;
}
.hole-panel {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}
.hole-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}
.hole-tabs button {
  border-radius: 8px;
  padding: 0.35rem 0;
  min-width: 0;
}
.hole-tabs button.active {
  background: var(--accent);
  color: #102015;
  border-color: transparent;
  font-weight: 700;
}
.hole-tabs button.complete {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pin-mode {
  display: grid;
  gap: 0.45rem;
}
.coord-readout p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.pin {
  display: inline-block;
  min-width: 2.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.35rem;
}
.pin.tee { background: #2f6fed; color: white; }
.pin.flag { background: #d94c4c; color: white; }
.course-map {
  min-height: 420px;
  height: 55vh;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #0c130e;
}
.map-pin {
  display: grid;
  place-items: center;
}
.map-pin span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: white;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
.tee-pin span { background: #2f6fed; }
.flag-pin span { background: #d94c4c; }
@media (max-width: 860px) {
  .editor-layout { grid-template-columns: 1fr; }
  .course-map { height: 45vh; }
}
