:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #132238;
  --muted: #667085;
  --line: #d9e1ec;
  --primary: #1478ff;
  --primary-dark: #0f5ecc;
  --accent: #16a36a;
  --warn: #d9480f;
  --shadow: 0 18px 48px rgba(19, 34, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
select,
textarea,
button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.admin-topbar {
  background: rgba(19, 34, 56, 0.94);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.16);
}

.brand,
.topnav,
.hero-actions,
.friend-actions,
.admin-tools,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 0.82rem;
}

.topnav {
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.95rem;
}

.admin-topbar .topnav {
  color: rgba(255, 255, 255, 0.76);
}

.topnav a {
  padding: 8px 10px;
  border-radius: 8px;
}

.topnav a:hover,
.nav-button:hover {
  background: rgba(20, 120, 255, 0.1);
  color: var(--primary);
}

.nav-button {
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  align-items: center;
  gap: 32px;
  min-height: calc(100vh - 69px);
  padding: clamp(42px, 8vw, 96px) clamp(18px, 5vw, 64px);
  background:
    linear-gradient(120deg, rgba(19, 34, 56, 0.82), rgba(19, 34, 56, 0.42)),
    url("https://images.unsplash.com/photo-1518611012118-696072aa579a?auto=format&fit=crop&w=1800&q=80") center/cover;
  color: #fff;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero .eyebrow,
.admin-hero .eyebrow {
  color: #9fd0ff;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 5.1rem);
  max-width: 900px;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
}

h3 {
  margin: 0 0 14px;
}

.hero-copy p:not(.eyebrow) {
  max-width: 640px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.15rem;
}

.hero-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-panel div,
.metric-card {
  display: grid;
  gap: 4px;
}

.hero-panel strong,
.metric-card strong {
  font-size: 2rem;
}

.hero-panel span {
  color: rgba(255, 255, 255, 0.78);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.button.primary {
  color: #fff;
  background: var(--primary);
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  color: var(--primary);
  background: #fff;
  border-color: var(--line);
}

.button.ghost {
  color: var(--warn);
  background: transparent;
  border-color: rgba(217, 72, 15, 0.35);
}

.section {
  padding: clamp(42px, 7vw, 86px) clamp(18px, 5vw, 64px);
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.filters,
.admin-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-tools {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}

.map {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.42) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.42) 1px, transparent 1px),
    linear-gradient(135deg, #d7ecd9, #dcecff 48%, #f3ead0);
  background-size: 48px 48px, 48px 48px, auto;
  box-shadow: var(--shadow);
}

.map > p {
  z-index: 1;
  max-width: 280px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.map::before,
.map::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.map::before {
  width: 56%;
  height: 56%;
  left: 14%;
  top: 20%;
  border: 2px dashed rgba(20, 120, 255, 0.34);
}

.map::after {
  width: 24%;
  height: 24%;
  right: 12%;
  bottom: 16%;
  background: rgba(22, 163, 106, 0.16);
}

.marker {
  position: absolute;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 20px rgba(19, 34, 56, 0.24);
  font-size: 0.8rem;
  font-weight: 900;
}

.marker.private {
  background: var(--accent);
}

.side-panel,
.form-card,
.metric-card,
.table-wrap,
.support-item,
.event-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(19, 34, 56, 0.06);
}

.side-panel {
  padding: 18px;
}

.event-list,
.support-list {
  display: grid;
  gap: 12px;
}

.event-card,
.support-item {
  padding: 16px;
}

.event-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.event-card h4,
.support-item h4 {
  margin: 0;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: rgba(20, 120, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 28px;
  align-items: start;
}

.hidden {
  display: none !important;
}

.auth-gate {
  display: grid;
  min-height: calc(100vh - 69px);
  place-items: center;
}

.auth-card {
  width: min(100%, 520px);
}

.protected-area {
  border-top: 1px solid var(--line);
}

.muted {
  color: var(--muted);
}

.form-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}

.form-message.error {
  color: var(--warn);
}

.form-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
  min-height: 0;
}

.metric-card {
  padding: 20px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
}

.quick-actions {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.modal {
  width: min(92vw, 720px);
  max-height: 82vh;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(19, 34, 56, 0.54);
}

.modal-head,
.list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.modal-head {
  margin-bottom: 18px;
}

.modal-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-list {
  display: grid;
  gap: 10px;
}

.list-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-hero {
  background: var(--ink);
  color: #fff;
}

.admin-hero .metric-card {
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-button {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.mini-button.danger {
  color: var(--warn);
  border-color: rgba(217, 72, 15, 0.36);
}

@media (max-width: 980px) {
  .hero,
  .map-layout,
  .split {
    grid-template-columns: 1fr;
  }

  .filters,
  .form-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    justify-content: flex-start;
  }

  .filters,
  .form-grid,
  .dashboard-grid,
  .admin-tools {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-actions,
  .friend-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
