:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --surface: #ffffff;
  --surface-strong: #eef5ef;
  --ink: #14231d;
  --muted: #68736d;
  --line: #dce3dc;
  --brand: #12372a;
  --brand-2: #2f8f5b;
  --accent: #d99b2b;
  --danger: #b93a32;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

button:hover {
  border-color: var(--brand-2);
}

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

button.ghost {
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

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

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 44px);
  color: #fff;
  background: linear-gradient(135deg, #12372a, #245c43);
}

.app-header h1,
.section-heading h2,
.panel h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #cfe7d4;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.88rem;
  font-weight: 750;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.user-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.88rem;
  font-weight: 750;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 32px) 44px;
}

.hidden {
  display: none !important;
}

.auth-view {
  display: grid;
  min-height: 55vh;
  place-items: start center;
}

.auth-panel {
  width: min(460px, 100%);
}

.auth-panel h2 {
  margin: 0 0 4px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

.tab {
  font-weight: 750;
  background: var(--surface-strong);
}

.tab.is-active {
  color: #fff;
  background: var(--brand);
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: grid;
  gap: 4px;
}

.section-heading p,
.muted {
  margin: 0;
  color: var(--muted);
}

.panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(20, 35, 29, 0.07);
}

.panel.compact {
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 650;
}

.form-message.success {
  color: var(--brand-2);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.location-switch {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px rgba(18, 55, 42, 0.04);
}

.location-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.location-switch label {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1;
}

.location-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.location-switch label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  min-width: 112px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  transition:
    background 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.location-switch label > span > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.location-switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.location-switch input:checked + span {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(18, 55, 42, 0.18);
}

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfa;
}

.user-row {
  grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr);
}

.user-actions {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(150px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.list-item strong,
.stat-card strong {
  display: block;
}

.list-item span,
.stat-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.stat-card .score {
  margin-top: 10px;
  color: var(--brand);
  font-size: 1.7rem;
  font-weight: 850;
}

.empty {
  color: var(--muted);
  padding: 12px 0;
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .settings-grid,
  .tabs,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .user-row,
  .user-actions {
    grid-template-columns: 1fr;
  }

  .button-row > button,
  .location-switch {
    width: 100%;
  }

  .location-switch label {
    flex: 1;
  }

  .location-switch label > span {
    min-width: 0;
  }
}
