:root {
  --bg: #f4f1e8;
  --ink: #1e2a2f;
  --muted: #667279;
  --line: #d8ded8;
  --panel: #ffffff;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #b63b18;
  --soft: #e7f1ef;
  --paper: #f9faf7;
  --danger: #a42121;
  --shadow: 0 18px 50px rgba(29, 42, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfaf5 0%, var(--bg) 48%, #e8efec 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
}

h3 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

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

.hidden {
  display: none !important;
}

.panel,
.auth-card,
.welcome-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.welcome-panel {
  min-height: 530px;
  padding: 34px;
  background:
    linear-gradient(rgba(15, 118, 110, 0.82), rgba(30, 42, 47, 0.76)),
    url("https://images.unsplash.com/photo-1529156069898-49953e39b3ac?auto=format&fit=crop&w=1200&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.welcome-panel .eyebrow,
.welcome-panel .muted {
  color: #ffedd5;
}

.welcome-panel h2 {
  max-width: 520px;
  margin-top: 90px;
}

.welcome-panel p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
  line-height: 1.6;
}

.mini-stats {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.mini-stats div,
.metric {
  background: var(--soft);
  border: 1px solid #cce0dc;
  border-radius: 8px;
  min-width: 140px;
  padding: 18px;
}

.mini-stats div {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.mini-stats strong,
.metric strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
}

.mini-stats span,
.metric span {
  color: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-card {
  overflow: hidden;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: #e8e5da;
  border-bottom: 1px solid var(--line);
  padding: 4px;
}

.auth-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  padding: 0 12px;
  font-weight: 900;
}

.auth-tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(30, 42, 47, 0.08);
}

.auth-panel {
  display: none;
  padding: 28px;
}

.auth-panel.active {
  display: grid;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

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

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--primary);
}

.primary,
.secondary,
.ghost,
.file-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 900;
}

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

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

.secondary,
.file-button {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.message {
  min-height: 22px;
  margin: 0;
  color: var(--primary);
  font-weight: 800;
}

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

.member-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.id-card {
  position: relative;
  aspect-ratio: 1.58;
  border-radius: 20px;
  border: 1px solid #cbd2dc;
  background:
    linear-gradient(90deg, rgba(225, 229, 236, 0.72) 0 16%, transparent 16%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 243, 248, 0.78)),
    #f8f8fc;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 22px 22px 18px;
}

.id-card-brand {
  position: relative;
  display: block;
  min-height: 136px;
  padding-right: 138px;
  z-index: 1;
}

.brand-text {
  text-align: center;
}

.id-card-brand p {
  margin-bottom: 0;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  font-weight: 950;
  line-height: 1.15;
}

.id-card-brand h2 {
  margin-bottom: 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.08;
}

.card-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: #202a32;
  font-weight: 900;
}

.card-title span {
  font-size: 1.05rem;
}

.card-title strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.card-title b {
  background: #dfe3eb;
  padding: 7px 11px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 1.08rem;
}

.id-card-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 16px;
  align-items: end;
  margin-top: -28px;
}

.card-media {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.photo-box {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  width: 120px;
  height: 144px;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent),
    linear-gradient(160deg, #d7ece9, #fdf2e9);
  border: 1px solid #bfc9cf;
  color: var(--primary-dark);
  font-size: 2rem;
  font-weight: 950;
}

.photo-box img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-box img.visible {
  display: block;
}

.qr-code {
  width: 82px;
  height: 82px;
  border: 5px solid #fff;
  background: #fff;
  box-shadow: 0 0 0 1px #d4d9dd;
}

dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 150px 1fr;
  min-height: 34px;
  background: #dfe3eb;
}

dt,
dd {
  margin: 0;
  padding: 7px 10px;
  font-size: 0.95rem;
  line-height: 1.2;
}

dt {
  color: #202a32;
  font-weight: 850;
}

dd {
  background: rgba(255, 255, 255, 0.42);
  font-weight: 900;
}

.profile-panel {
  padding: 28px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.profile-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.profile-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
}

.photo-form {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  margin-bottom: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  box-shadow: none;
}

.admin-dashboard {
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.inline-form,
.head-actions,
.code-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form input {
  width: 150px;
}

.code-tools {
  padding: 16px 22px 0;
}

.code-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow: auto;
  padding: 22px;
}

.code-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  font-weight: 800;
}

.code-chip.used {
  color: var(--muted);
  text-decoration: line-through;
  background: #f1f2ef;
}

.search {
  max-width: 320px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-weight: 650;
}

.settings-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 22px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 860px) {
  .topbar,
  .auth-layout,
  .member-layout,
  .dashboard-head,
  .section-head {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .welcome-panel {
    min-height: 360px;
  }

  .welcome-panel h2 {
    margin-top: 54px;
  }

  .split,
  .metrics,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .id-card {
    aspect-ratio: auto;
  }

  .id-card-body {
    grid-template-columns: 1fr;
  }

  .photo-box {
    max-width: 170px;
  }

  dl div {
    grid-template-columns: 1fr;
  }

  .inline-form,
  .head-actions,
  .code-tools,
  .session-actions {
    width: 100%;
  }

  .inline-form button,
  .inline-form input,
  .head-actions button,
  .file-button,
  .code-tools button,
  .search {
    flex: 1 1 auto;
    max-width: none;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .profile-panel,
  .auth-layout,
  .admin-dashboard {
    display: none !important;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .member-layout {
    display: block;
  }

  .id-card {
    width: 86mm;
    min-height: 54mm;
    box-shadow: none;
    border-radius: 4mm;
    page-break-inside: avoid;
  }
}

/* Public website */
.public-site { background: #f7f5ed; color: #203d32; }
.public-site .shell { width: min(1180px, calc(100% - 48px)); padding-top: 24px; }
.public-site a { color: inherit; text-decoration: none; }
.public-site a:focus-visible, .home-link:focus-visible { outline: 3px solid #bd5a33; outline-offset: 6px; }
.skip-link { position: absolute; top: -80px; background: white; padding: 12px; z-index: 10; }
.skip-link:focus { top: 8px; }
.public-header, .public-header nav, .public-brand { display: flex; align-items: center; }
.public-header { justify-content: space-between; gap: 24px; padding-bottom: 28px; }
.public-brand { gap: 12px; font-size: 1rem; font-weight: 800; line-height: 1.25; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 54px; background: #174b3b; color: #fff8e4; border-radius: 8px 8px 22px 22px; font-size: .85rem; letter-spacing: .06em; }
.public-header nav { gap: 28px; font-size: .9rem; font-weight: 650; }
.public-site .site-button { display: inline-flex; align-items: center; justify-content: center; gap: 24px; padding: 15px 22px; background: #174b3b; color: #fff; border-radius: 5px; font-size: .9rem; font-weight: 650; }
.public-site .site-button:hover { background: #24624d; }
.public-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; padding: 40px 0 50px; }
.public-site .eyebrow { color: #a04c2c; letter-spacing: .12em; font-size: .7rem; margin-bottom: 20px; }
.hero-copy h1 { font-family: Georgia, serif; font-weight: 400; font-size: clamp(2.9rem, 5.4vw, 4.8rem); line-height: 1.06; letter-spacing: -.05em; margin-bottom: 26px; }
.hero-copy h1 em { color: #9e4d2f; font-weight: 400; }
.hero-copy > p:not(.eyebrow) { color: #607065; line-height: 1.8; max-width: 425px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 30px; }
.text-link { font-size: .9rem; font-weight: 650; }
.hero-landscape { height: 460px; position: relative; overflow: hidden; border-radius: 160px 160px 8px 8px; background: #dfdac5; isolation: isolate; }
.landscape-sun { position: absolute; width: 110px; height: 110px; border-radius: 50%; background: #d9a263; left: 49%; top: 50px; }
.mountain { position: absolute; width: 140%; height: 85%; clip-path: polygon(0 100%, 8% 44%, 29% 9%, 43% 41%, 59% 14%, 80% 55%, 100% 38%, 100% 100%); }
.mountain-back { background: #94a595; left: -10%; bottom: 0; }
.mountain-front { background: #426e58; left: -24%; bottom: -20%; transform: scaleX(-1); }
.landscape-trail { position: absolute; width: 200px; height: 260px; background: #bfaf83; bottom: -155px; left: 45%; border-radius: 50%; transform: rotate(-35deg); }
.cedar { position: absolute; width: 155px; height: 220px; bottom: 25px; background: #1e4939; clip-path: polygon(50% 0, 68% 22%, 59% 22%, 83% 43%, 67% 43%, 99% 68%, 54% 68%, 54% 100%, 46% 100%, 46% 68%, 1% 68%, 33% 43%, 17% 43%, 41% 22%, 32% 22%); }
.cedar-one { left: 15px; }
.cedar-two { right: -35px; bottom: -28px; height: 280px; width: 190px; }
.cedar-three { left: 125px; bottom: 30px; height: 120px; width: 85px; }
.landscape-caption { position: absolute; left: 28px; top: 35px; font: italic 1.15rem/1.35 Georgia, serif; max-width: 150px; }
.values-strip { display: flex; justify-content: space-around; align-items: center; gap: 12px; padding: 24px 0; border-top: 1px solid #d5dccf; border-bottom: 1px solid #d5dccf; font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; }
.values-strip [aria-hidden] { color: #a04c2c; }
.public-section { padding: 68px 0 10px; scroll-margin-top: 24px; }
.public-site h2 { font: 400 clamp(2rem, 3.4vw, 3rem)/1.12 Georgia, serif; letter-spacing: -.025em; }
.about-section { display: grid; grid-template-columns: 1fr 1.2fr; gap: 65px; }
.about-copy p { color: #607065; line-height: 1.8; }
.about-copy p:first-child { color: #203d32; font-size: 1.2rem; }
.scouting-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 30px; }
.scouting-grid article { padding: 30px; border: 1px solid #d5dccf; border-radius: 6px; background: #eeeee2; }
.scouting-grid article:nth-child(2) { background: #e6ece2; }
.scouting-grid article:nth-child(3) { background: #f0e6d8; }
.activity-number { font-size: .68rem; letter-spacing: .12em; color: #6b7466; }
.scouting-grid h3 { font: 400 1.55rem/1.2 Georgia, serif; margin: 32px 0 16px; }
.scouting-grid p { font-size: .95rem; line-height: 1.7; color: #607065; margin-bottom: 0; }
.join-banner { display: flex; align-items: center; justify-content: space-between; gap: 40px; margin-top: 64px; padding: 42px; background: #174b3b; color: #fff8e4; border-radius: 6px; }
.join-banner p:not(.eyebrow) { max-width: 660px; line-height: 1.7; color: #d6e0d2; margin-bottom: 0; }
.join-banner .eyebrow { color: #e6ba7c; }
.join-banner .site-button { flex-shrink: 0; background: #f5ead2; color: #174b3b; }
.join-banner .site-button:hover { background: #e5d4af; }
.public-footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 36px; font-size: .8rem; color: #607065; }
.public-footer > span { font-weight: 750; color: #203d32; }
.public-footer p { margin: 0; }
.home-link { display: inline-block; margin-top: 14px; color: var(--primary-dark); }
@media (max-width: 760px) {
  .public-header { flex-wrap: wrap; }
  .public-header nav { flex-wrap: wrap; gap: 20px; }
  .public-hero { grid-template-columns: 1fr; padding-top: 24px; }
  .hero-landscape { height: 360px; }
  .about-section, .scouting-grid { grid-template-columns: 1fr; gap: 20px; }
  .public-section { padding-top: 48px; }
  .values-strip { flex-wrap: wrap; font-size: .65rem; letter-spacing: .05em; }
  .join-banner { flex-direction: column; align-items: flex-start; padding: 28px; }
  .public-footer { flex-wrap: wrap; }
}
