:root {
  color: #17201c;
  background: #f7f8f5;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  --ink: #17201c;
  --muted: #5d6862;
  --surface: #ffffff;
  --line: #d9dfda;
  --accent: #176b4d;
  --accent-dark: #0f4b36;
  --danger: #9c2f2f;
  --warning: #735300;
  --radius: 0.55rem;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 18rem;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f7f8f5;
}

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

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

button,
input,
textarea,
a {
  outline-offset: 0.2rem;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 0.2rem solid #51a985;
}

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

h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.25rem;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.55rem 0.75rem;
  color: white;
  background: var(--accent-dark);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  display: flex;
  min-height: 3.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem max(1rem, calc((100vw - 72rem) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.wordmark {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.page-shell {
  width: min(72rem, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.page-heading,
.section-heading,
.map-toolbar,
.button-row,
.room-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.page-heading {
  margin-bottom: 1rem;
  align-items: end;
}

.eyebrow {
  margin-bottom: 0.25rem;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.lede,
.muted,
.help,
.status {
  color: var(--muted);
}

.help,
.status,
.muted {
  font-size: 0.9rem;
}

.status {
  min-height: 1.4em;
  margin: 0;
}

.notice {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 0.25rem solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice--error {
  border-left-color: var(--danger);
}

.notice--warning {
  border-left-color: var(--warning);
}

.map-toolbar {
  justify-content: flex-start;
  margin-bottom: 0.65rem;
}

.map {
  z-index: 0;
  width: 100%;
  height: clamp(23rem, 64vh, 42rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e9eeea;
}

.privacy-note {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: baseline;
  margin: 0.65rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.privacy-note h2,
.privacy-note p {
  margin: 0;
  font-size: inherit;
}

.tracker-list,
.room-list {
  padding: 0;
  list-style: none;
}

.tracker-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem;
}

.tracker-card,
.room-row {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tracker-card {
  border-top: 0.25rem solid var(--tracker-color, var(--accent));
}

.tracker-card dl,
.credential-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.65rem;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.tracker-card dt,
.credential-card dt {
  color: var(--muted);
}

.tracker-card dd,
.credential-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

.button,
.text-button {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 2.6rem;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 0.4rem;
  color: white;
  background: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button--quiet {
  color: var(--accent-dark);
  background: var(--surface);
}

.button--quiet:hover {
  color: white;
}

.button--danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button--danger:hover {
  background: #752222;
}

.text-button {
  padding: 0.35rem;
  color: var(--accent-dark);
  background: transparent;
  text-decoration: underline;
}

.narrow-panel,
.panel {
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.narrow-panel {
  width: min(30rem, 100%);
  margin: 3rem auto;
}

.stacked-form,
.field {
  display: grid;
  gap: 0.45rem;
}

.stacked-form {
  gap: 1rem;
}

.field label {
  font-weight: 650;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid #9ca8a0;
  border-radius: 0.35rem;
  background: white;
}

.field .help {
  margin: 0;
}

.field .errorlist {
  margin: 0;
  color: var(--danger);
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(23rem, 100%), 1fr));
  gap: 1rem;
  align-items: start;
}

.secret-panel {
  border-color: #bca656;
}

.secret-value {
  max-height: 8rem;
  overflow: auto;
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: 0.35rem;
  background: #f1f3ef;
}

.verification-form {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.credentials {
  margin-top: 1.25rem;
}

.credential-card {
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.rooms {
  margin-top: 2rem;
}

.room-list {
  display: grid;
  gap: 0.6rem;
}

.room-close {
  display: flex;
  max-width: 27rem;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}

.room-close p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 42rem) {
  .page-heading,
  .privacy-note {
    display: block;
  }

  .page-heading .status {
    margin-top: 0.5rem;
  }

  .privacy-note > * + * {
    margin-top: 0.35rem;
  }

  .map-toolbar,
  .button-row,
  .room-row,
  .room-close {
    align-items: stretch;
    flex-direction: column;
  }

  .room-close {
    text-align: left;
  }

  .map-toolbar .button,
  .button-row .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
