:root {
  --bg: #f4efe5;
  --paper: #fffdf7;
  --paper2: #f9f2e4;
  --ink: #16213a;
  --muted: #5f6b7d;
  --blue: #172b55;
  --blue2: #0d1a36;
  --blue3: #213b73;
  --gold: #b89445;
  --gold2: #dfc27a;
  --line: #d8caa7;
  --ok: #287a45;
  --warn: #a66a00;
  --bad: #b4233a;
  --shadow: 0 18px 45px rgba(22, 33, 58, .14);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(223,194,122,.26), transparent 28rem),
    radial-gradient(circle at 100% 20%, rgba(23,43,85,.14), transparent 26rem),
    linear-gradient(180deg, #fffaf0 0%, var(--bg) 46%, #efe6d4 100%);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
}
body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    linear-gradient(rgba(184,148,69,.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184,148,69,.10) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 78%, transparent);
}
button, input, select, textarea { font: inherit; }
button {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border: 1px solid #8e6f27;
  border-radius: 10px;
  color: #17130a;
  font-weight: 850;
  padding: .82rem 1rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(184,148,69,.23);
}
button.secondary { background: #f8f4ea; color: var(--blue); border-color: var(--line); box-shadow: none; }
button:hover { filter: brightness(1.04); transform: translateY(-1px); }
input, select, textarea {
  width: 100%;
  padding: .82rem .88rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  box-shadow: inset 0 1px 0 rgba(22,33,58,.03);
}
label { display: block; color: var(--muted); font-size: .9rem; margin: .72rem 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.hero {
  color: #fff;
  background:
    radial-gradient(circle at 12% 8%, rgba(223,194,122,.24), transparent 18rem),
    linear-gradient(135deg, var(--blue2), var(--blue) 58%, #10264d);
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 14px 34px rgba(13,26,54,.25);
  position: sticky;
  top: 0;
  z-index: 5;
}
.hero-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px clamp(18px, 5vw, 46px);
  display: flex;
  gap: 1.1rem;
  justify-content: space-between;
  align-items: center;
}
.brand-lockup { display: flex; align-items: center; gap: 16px; min-width: 0; }
.mark {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  border: 2px solid var(--gold2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gold2);
  font-size: 31px;
  font-weight: 900;
  font-family: Georgia, 'Times New Roman', serif;
  box-shadow: inset 0 0 0 5px rgba(223,194,122,.11), 0 0 28px rgba(223,194,122,.12);
}
.mark img { width: 72%; height: 72%; display: block; }
.eyebrow { letter-spacing: .18em; text-transform: uppercase; color: var(--gold2); font-weight: 900; margin: 0 0 .25rem; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.hero h1 { margin: .1rem 0; font-size: clamp(1.65rem, 4vw, 3.25rem); line-height: 1.02; text-wrap: balance; }
.sub { margin: .35rem 0 0; color: #dbe5f4; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: clamp(1rem, 1.7vw, 1.17rem); line-height: 1.38; max-width: 62ch; }
.powered { border: 1px solid rgba(223,194,122,.62); border-radius: 999px; padding: .58rem .85rem; color: #f7e7b4; white-space: nowrap; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: rgba(255,255,255,.06); backdrop-filter: blur(8px); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 16px; align-items: start; }
.hidden { display: none !important; }
.landing { width: min(1180px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(280px, 1.25fr) minmax(260px, .78fr) minmax(260px, .78fr); gap: 18px; padding: 18px; align-items: start; }
.intro-panel h2 { color: var(--blue); font-size: clamp(1.7rem, 3.4vw, 3.05rem); line-height: 1.04; letter-spacing: -.02em; margin: .25rem 0 .7rem; text-wrap: balance; }
.intro-panel p, .feature-list { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--muted); line-height: 1.58; }
.feature-list { padding-left: 1.25rem; margin-bottom: .5rem; }
.feature-list li { margin: .55rem 0; }
.promise-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 1rem 0; }
.promise-grid article { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: linear-gradient(180deg, #fff, var(--paper2)); }
.promise-grid strong { display: block; color: var(--blue); font-size: 1.28rem; line-height: 1.1; }
.promise-grid span { color: var(--muted); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: .83rem; line-height: 1.25; }
.callout-note { padding: .85rem 1rem; border: 1px dashed var(--gold); border-radius: 14px; background: #fbf5e8; }
.auth-panel h2 { color: var(--blue); }
.role-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.role-pill { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .65rem; background: #f8f4ea; color: var(--blue); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: .85rem; font-weight: 700; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 12px 0; }
.role-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #f8f4ea; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.role-card strong { display: block; color: var(--blue); text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
.role-card span { display: block; color: var(--gold); font-weight: 800; margin: .2rem 0; }
.role-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.admin-main { padding: 16px; display: grid; gap: 16px; }
.panel {
  background: rgba(255,253,247,.94);
  border: 1px solid rgba(216,202,167,.9);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(6px);
}
.panel:before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--blue), var(--gold), var(--blue)); opacity: .95; }
.panel h2 { margin: 8px 0 12px; color: var(--blue); font-size: 1.35rem; }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.locator-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto auto; gap: 8px; align-items: center; }
.tonight-badge{display:inline-block;font-size:12px;padding:2px 9px;border-radius:999px;background:linear-gradient(135deg,var(--blue),var(--blue3));color:var(--gold2);vertical-align:middle;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;}
.tonight-banner{border:1px solid var(--gold);border-radius:12px;padding:10px 12px;margin:0 0 12px;background:linear-gradient(160deg,rgba(184,148,69,.14),rgba(184,148,69,.04));font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:.95rem;display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.year-review{margin:10px 0;}
.year-review summary{cursor:pointer;color:var(--blue);font-weight:700;}
.year-review-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(96px,1fr));gap:10px;margin-top:10px;}
.year-review-grid div{border:1px solid var(--line);border-radius:12px;padding:10px;text-align:center;background:linear-gradient(180deg,#fff,var(--paper2));}
.year-review-grid .wide{grid-column:1 / -1;}
.year-review-grid strong{display:block;color:var(--blue);font-size:1.15rem;}
.year-review-grid span{color:var(--muted);font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:.8rem;}
.danger-zone{margin-top:14px;border-top:1px solid var(--line);padding-top:10px;}
.danger-zone summary{cursor:pointer;color:var(--bad);font-weight:700;}
.trends-chart{display:grid;gap:6px;margin:10px 0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;}
.trend-row{display:grid;grid-template-columns:64px 1fr minmax(150px,auto);gap:10px;align-items:center;font-size:.85rem;}
.trend-label{color:var(--muted);}
.trend-bar{background:var(--paper2);border:1px solid var(--line);border-radius:999px;height:16px;overflow:hidden;display:block;}
.trend-fill{display:block;height:100%;background:var(--blue3);border-radius:999px;overflow:hidden;}
.trend-verified{display:block;height:100%;background:linear-gradient(135deg,var(--gold),var(--gold2));}
.trend-count small{color:var(--muted);}
.visit-tools{margin-top:6px;display:flex;gap:6px;}
.verify-email{border:1px solid var(--gold);border-radius:12px;padding:10px 12px;margin:8px 0;background:linear-gradient(160deg,rgba(184,148,69,.12),rgba(184,148,69,.03));}
.badge button{margin-top:6px;align-self:flex-start;}
.diff-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:10px;margin:10px 0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;}
.diff-summary div{border:1px solid var(--line);border-radius:12px;padding:10px;text-align:center;background:linear-gradient(180deg,#fff,var(--paper2));}
.diff-summary strong{display:block;color:var(--blue);font-size:1.2rem;}
.diff-summary span{color:var(--muted);font-size:.8rem;}
.locator-tools button { padding: .72rem .85rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.status { min-height: 1.2em; color: var(--muted); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.stats div { background: #f8f4ea; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stats strong { display: block; font-size: 1.9rem; color: var(--blue); font-family: Georgia, 'Times New Roman', serif; }
.stats span { color: var(--muted); font-size: .85rem; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.locator-panel { min-height: 72vh; }
.lodge-list { margin-top: 12px; display: grid; gap: 8px; overflow: visible; }
.lodge-card { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: 12px; padding: 12px; cursor: pointer; }
.selected-from-map { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; padding:10px 12px; border:1px dashed var(--gold); border-radius:12px; background:linear-gradient(160deg,rgba(184,148,69,.16),rgba(184,148,69,.04)); color:var(--blue); font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif; }
.selected-rank { color: var(--gold); }
.rank-label { color: var(--muted); font-size: .78rem; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .25rem; }
.lodge-card:hover, .lodge-card.active { border-color: var(--gold); border-left-color: var(--gold); box-shadow: 0 8px 18px rgba(184,148,69,.18); }
.lodge-card h3 { margin: .1rem 0; color: var(--blue); }
.lodge-meta { color: var(--muted); font-size: .9rem; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.directions-link { display: inline-flex; align-items: center; justify-content: center; padding: .62rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: #f8f4ea; color: var(--blue); font-weight: 800; text-decoration: none; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.directions-link:before { content: "↗"; margin-right: .35rem; }
.selected { padding: 12px; border-radius: 12px; background: #f8f4ea; border: 1px dashed var(--gold); }
#map { height: 320px; border-radius: 14px; border: 1px solid var(--line); margin-top: 12px; overflow: hidden; }
.timeline { display: grid; gap: 10px; }
.visit-item { border-left: 5px solid var(--gold); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.visit-item small { color: var(--muted); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
th { color: var(--blue); background: #f8f4ea; }

.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(248,244,234,.75); }
.admin-form label { margin: 0; }
.admin-form button { align-self: end; }
.compact-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.compact-filters input { width: 120px; padding: .62rem .7rem; }
button.mini { padding: .45rem .6rem; border-radius: 8px; font-size: .82rem; }
.inline-input { min-width: 110px; padding: .45rem .55rem; font-size: .88rem; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 220px; }
button.danger { background: #8b1e1e; border-color: #8b1e1e; color: #fff; }
#auditBody td, #usersBody td { font-size: .9rem; }
@media(max-width:560px) {
  .panel-title { align-items: flex-start; flex-direction: column; }
  .compact-filters { justify-content: stretch; width: 100%; }
  .compact-filters input, .compact-filters button { width: 100%; }
}

@media(max-width:1050px) {
  .layout, .landing { grid-template-columns: 1fr; }
  .hero { position: static; }
  .hero-inner { flex-direction: column; align-items: flex-start; padding: 22px 18px 26px; }
  .powered { white-space: normal; }
  .lodge-list { max-height: none; }
  .brand-lockup { align-items: flex-start; }
  .mark { width: 50px; height: 50px; font-size: 25px; }
  .locator-tools { grid-template-columns: 1fr 1fr; }
  .locator-tools input { grid-column: 1 / -1; }
  #map { height: 360px; }
}
@media(max-width:560px) {
  .hero-inner { padding: 20px 18px 24px; gap: .9rem; }
  .brand-lockup { gap: 12px; width: 100%; }
  .mark { width: 46px; height: 46px; font-size: 23px; }
  .eyebrow { font-size: .82rem; letter-spacing: .2em; }
  .hero h1 { font-size: clamp(1.78rem, 7.2vw, 2.24rem); line-height: 1.04; }
  .sub { font-size: 1rem; }
  .powered { align-self: flex-start; font-size: .95rem; }
  .landing, .layout, .admin-main { padding: 12px; gap: 12px; }
  .panel { border-radius: 16px; padding: 16px; }
  .intro-panel h2 { font-size: clamp(1.65rem, 8vw, 2.15rem); }
  .promise-grid { grid-template-columns: 1fr; }
  .feature-list { padding-left: 1.05rem; }
  .feature-list li { margin: .48rem 0; }
}

/* ---------- v1.0 offline-first additions ---------- */
.hero-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.net-badge{font-size:12px;padding:4px 10px;border-radius:999px;border:1px solid transparent}
.net-online{background:#12351f;color:#7ee2a8;border-color:#1d5c35}
.net-poor{background:#3a2f10;color:#e2c97e;border-color:#6b5620}
.net-offline{background:#3a1a12;color:#e2977e;border-color:#6b3220}

.chip{display:inline-block;font-size:11px;padding:2px 8px;border-radius:999px;margin-left:6px;vertical-align:middle}
.chip-verified{background:#12351f;color:#7ee2a8}
.chip-recorded{background:#1d2c4d;color:#9db8ef}
.chip-pending{background:#3a2f10;color:#e2c97e}
.chip-local{background:#2b2b33;color:#c9c9d4}
.chip-rejected{background:#3a1a12;color:#e2977e}
.chip-muted{background:#26262c;color:#8a8a94}
.visit-item.local{opacity:.85;border-left:3px dashed #b89445;padding-left:10px}
.warn{color:#e2977e}

.scan-row{display:flex;gap:10px;align-items:end;margin:8px 0}
.scan-row .grow{flex:1}
.scanner{margin:10px 0;text-align:center}
.scanner video{width:100%;max-width:420px;border-radius:12px;border:2px solid #b89445}
.scanner button{margin-top:8px}

.badge-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px}
.badge{border:1px solid #2e2e38;border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:4px;opacity:.55}
.badge.earned{opacity:1;border-color:#b89445;box-shadow:0 0 0 1px #b8944533}
.badge strong{font-size:14px}
.badge span{font-size:12px;color:#9a9aa6}
.badge em{font-size:11px;color:#b89445;font-style:normal}
.badge.tier2{background:linear-gradient(160deg,rgba(184,148,69,.08),transparent)}

.pending-actions{display:flex;gap:6px}
.pending-actions button{padding:4px 10px;font-size:12px}
.bulk-row{display:flex;gap:8px;align-items:end;flex-wrap:wrap;margin:8px 0}

/* ---------- member-area menu & focused views (mobile-first) ---------- */
.menu-btn{
  display:none; position:fixed; top:14px; right:14px; z-index:60;
  width:48px; height:48px; padding:0; border-radius:14px; font-size:22px; line-height:1;
  align-items:center; justify-content:center;
}
.drawer-backdrop{position:fixed; inset:0; background:rgba(13,26,54,.45); z-index:65; backdrop-filter:blur(2px);}
.drawer{
  position:fixed; top:0; right:0; bottom:0; z-index:70; width:min(300px,84vw);
  background:var(--paper); border-left:1px solid var(--line); box-shadow:var(--shadow);
  padding:18px 16px calc(18px + env(safe-area-inset-bottom)); display:flex; flex-direction:column; gap:8px;
}
.drawer-title{margin:2px 4px 10px; font-weight:700; color:var(--blue); letter-spacing:.06em;}
.drawer button{
  background:#f8f4ea; color:var(--blue); border:1px solid var(--line); box-shadow:none;
  text-align:left; font-size:1.05rem; padding:.95rem 1rem; border-radius:12px;
}
.drawer button.active{background:linear-gradient(135deg,var(--gold),var(--gold2)); color:#17130a; border-color:#8e6f27;}
.drawer hr{width:100%; border:0; border-top:1px solid var(--line); margin:auto 0 8px;}
.drawer .drawer-logout{color:var(--bad);}
.mobile-only{display:none;}

/* Logged-in app mode: compact header + top-right menu. Desktop focuses on the working
   area; member details, logout, and timeline live in the menu instead of permanent sidebars. */
body.app-mode .hero{border-bottom-width:2px; box-shadow:0 8px 18px rgba(13,26,54,.18);}
body.app-mode .hero-inner{padding:10px 74px 10px 16px; flex-direction:row; align-items:center;}
body.app-mode .hero .sub, body.app-mode .hero .powered{display:none;}
body.app-mode .hero h1{font-size:1.08rem; line-height:1.12; margin:0;}
body.app-mode .hero .eyebrow{font-size:.68rem; margin:0 0 .05rem; letter-spacing:.16em;}
body.app-mode .mark{width:34px; height:34px; font-size:17px;}
body.app-mode .brand-lockup{gap:10px;}
body.app-mode .hero-right{flex-direction:row; align-items:center;}
body.app-mode .menu-btn{display:flex;}
body.app-mode #appShell > .panel{display:none;}
body.app-mode #appShell.view-checkin .locator-panel,
body.app-mode #appShell.view-checkin .visit-panel,
body.app-mode #appShell.view-lodges .locator-panel,
body.app-mode #appShell.view-passport .timeline-panel,
body.app-mode #appShell.view-passport .badges-panel,
body.app-mode #appShell.view-profile .profile-panel{display:block;}
body.app-mode #appShell.view-lodges,
body.app-mode #appShell.view-profile{grid-template-columns:minmax(0, 1120px); justify-content:center;}
body.app-mode #appShell.view-passport{grid-template-columns:minmax(0, 1fr) 360px;}
body.app-mode .profile-panel #logoutBtn{display:none;}
body.app-mode .locator-panel{min-height:calc(100vh - 96px);}
body.app-mode .lodge-list{overflow:visible;}

@media(max-width:1050px){
  body.app-mode .menu-btn{display:flex;}
  .mobile-only{display:block;}
  /* Slim the header down once a member is logged in — the app, not the pitch, is the point. */
  body.app-mode .hero-inner{padding:14px 74px 14px 16px; flex-direction:row; align-items:center;}
  body.app-mode .hero .sub, body.app-mode .hero .powered{display:none;}
  body.app-mode .hero h1{font-size:1.05rem; line-height:1.15;}
  body.app-mode .hero .eyebrow{font-size:.7rem; margin:0;}
  body.app-mode .mark{width:36px; height:36px; font-size:18px;}
  body.app-mode .hero-right{flex-direction:row; align-items:center;}
  /* One focused view at a time, chosen from the drawer. */
  body.app-mode #appShell > .panel{display:none;}
  body.app-mode #appShell.view-checkin .visit-panel{display:block;}
  body.app-mode #appShell.view-lodges .locator-panel{display:block;}
  body.app-mode #appShell.view-passport .timeline-panel,
  body.app-mode #appShell.view-passport .badges-panel{display:block;}
  body.app-mode #appShell.view-profile .profile-panel{display:block;}
  body.app-mode .locator-panel{min-height:0;}
}
