:root {
  color-scheme: light;
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #eef2f5;
  --text: #17212b;
  --muted: #5d6b78;
  --border: #d8e0e7;
  --accent: #176b5b;
  --accent-hover: #105548;
  --accent-soft: #dff3ed;
  --danger: #a33232;
  --danger-soft: #fbe7e7;
  --warning: #8a5b00;
  --warning-soft: #fff3cf;
  --shadow: 0 16px 40px rgba(31, 48, 61, 0.09);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 280px;
  margin: 0;
  color: var(--text);
  background: var(--background);
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 0.15rem;
  font-size: 1.05rem;
}

form {
  margin: 0;
}

label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 650;
}

input,
textarea,
button,
.button {
  min-height: 46px;
  border-radius: 0.6rem;
  font: inherit;
}

input,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.8rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
.button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 107, 91, 0.25);
  outline-offset: 2px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

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

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

.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efcaca;
}

.full-width {
  width: 100%;
}

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

.hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  font-weight: 400;
}

.eyebrow {
  margin-bottom: 0.6rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0.65rem max(1rem, calc((100vw - 1100px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links a,
.link-button {
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  color: var(--text);
  background: transparent;
  border: 0;
  font-weight: 650;
  text-decoration: none;
}

.auth-page,
.centered-page {
  display: grid;
  min-height: 100vh;
  padding: 1rem;
  place-items: center;
}

.admin-nav + .centered-page {
  min-height: calc(100vh - 65px);
}

.auth-card,
.welcome-card {
  width: min(100%, 440px);
  padding: clamp(1.4rem, 5vw, 2.2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.home-page {
  width: min(100% - 2rem, 1100px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) 0;
}

.admin-nav + .home-page {
  min-height: calc(100vh - 65px);
}

.home-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.home-header > div:first-child {
  max-width: 720px;
}

.home-header h1 {
  max-width: 14ch;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.home-actions form {
  display: flex;
}

.site-list {
  margin-top: 0;
}

.site-list h2 {
  margin-bottom: 0.35rem;
}

.site-list p {
  margin-bottom: 0;
  color: var(--muted);
}

.site-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1rem;
}

.site-tile {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  flex: 1 1 260px;
  gap: 0.75rem;
  align-items: center;
  min-width: min(100%, 260px);
  min-height: 82px;
  padding: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  box-shadow: 0 6px 18px rgba(31, 48, 61, 0.04);
  text-decoration: none;
}

.site-tile:hover {
  border-color: #9bb5ac;
}

.site-tile img,
.site-mark {
  width: 44px;
  height: 44px;
  border-radius: 0.45rem;
}

.site-tile img {
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
}

.site-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.site-tile strong,
.site-tile small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-tile small {
  margin-top: 0.1rem;
  color: var(--muted);
}

.sessions {
  margin-top: 2rem;
}

.session-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.sessions > form {
  margin-top: 1rem;
}

.page {
  width: min(100% - 2rem, 1100px);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) 0;
}

.narrow-page {
  max-width: 720px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header > p:last-child {
  color: var(--muted);
}

.panel {
  margin-bottom: 2rem;
  padding: clamp(1.1rem, 4vw, 1.6rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: 0 6px 20px rgba(31, 48, 61, 0.04);
}

.form-grid,
.two-column {
  display: grid;
  gap: 1rem;
}

.form-grid label {
  margin-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 3rem;
}

.section-heading h2 {
  margin-bottom: 0;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.5rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.card-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.list-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
}

.list-card p {
  margin-bottom: 0;
}

.compact-details,
.details {
  margin: 0;
}

.compact-details > div,
.details > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.compact-details > div:last-child,
.details > div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.card-actions,
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.card-actions > *,
.share-actions > * {
  flex: 1;
}

.card-actions button {
  width: 100%;
}

.empty-state {
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 0.8rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.status {
  padding: 0.9rem 1rem;
  border-radius: 0.7rem;
}

.error {
  color: #7d2424;
  background: var(--danger-soft);
}

.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.invite-panel {
  text-align: center;
}

.invite-panel label {
  text-align: left;
}

.qr-code {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 0 auto 1.5rem;
  padding: 0.6rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
}

@media (min-width: 720px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-wide {
    grid-column: 1 / -1;
  }

  .two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-card {
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) auto;
    align-items: center;
  }

.compact-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  .compact-details > div {
    border-bottom: 0;
  }

  .card-actions > * {
    flex: initial;
  }
}

.audit-list {
  display: grid;
  gap: 0.75rem;
}

.audit-event {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.audit-event > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

.audit-event time {
  color: var(--muted);
}

@media (max-width: 520px) {
  .admin-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links a,
  .link-button {
    padding-inline: 0.45rem;
  }

  .admin-nav + .centered-page {
    min-height: calc(100vh - 112px);
  }
}
