/* =========================================================
   CHALLENGE ROUTE SITE - Global Styles
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:    #2ecc71;
  --green-dk: #27ae60;
  --amber:    #f39c12;
  --grey:     #95a5a6;
  --grey-lt:  #ecf0f1;
  --navy:     #06516C;
  --navy-lt:  #09759C;
  --orange:   #F47920;
  --orange-dk:#D25E0A;
  --white:    #ffffff;
  --text:     #2C3843;
  --text-lt:  #7f8c8d;
  --radius:   10px;
  --shadow:   0 4px 16px rgba(0,0,0,0.12);
}

body {
  font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  font-size: 2rem;
}

.header-logo {
  height: 38px;
  width: auto;
  display: block;
  background: rgba(255,255,255,0.92);
  border-radius: 5px;
  padding: 3px 7px;
}

.header-brand h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-sub {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-top: 2px;
}

.site-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: var(--white);
}

.nav-link.active {
  background: var(--orange);
  color: var(--white);
}

.nav-signout {
  cursor: pointer;
  font-family: inherit;
  opacity: 0.7;
}
.nav-signout:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* =========================================================
   ACTIVITY TICKER
   ========================================================= */
.activity-ticker {
  background: var(--navy-lt);
  color: var(--white);
  height: 34px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.76rem;
  /* Hidden until JS populates it */
  visibility: hidden;
}

.activity-ticker.ticker-ready { visibility: visible; }

.ticker-label {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  padding: 0 14px 0 16px;
  border-right: 1px solid rgba(255,255,255,0.2);
  margin-right: 12px;
  white-space: nowrap;
}

.ticker-viewport {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  will-change: transform;
}

.activity-ticker:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  padding: 0 20px;
  flex-shrink: 0;
}

.ticker-item strong {
  font-weight: 700;
}

.ticker-when {
  opacity: 0.55;
  font-size: 0.7rem;
  margin-left: 4px;
}

.ticker-sep {
  opacity: 0.3;
  flex-shrink: 0;
  font-size: 0.65rem;
}


/* =========================================================
   HOME PAGE LAYOUT
   ========================================================= */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 0;
  height: calc(100vh - 104px);
  max-height: 800px;
  position: relative;
}

.map-area {
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

/* =========================================================
   STAGE POPUP (on map)
   ========================================================= */
.stage-popup {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 800;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  width: 260px;
  border-left: 4px solid var(--green);
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-lt);
  line-height: 1;
}

.popup-close:hover { color: var(--text); }

.stage-popup h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding-right: 24px;
}

.popup-subtitle {
  font-size: 0.82rem;
  color: var(--text-lt);
  margin-bottom: 12px;
}

.popup-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.popup-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--grey-lt);
  border-radius: 4px;
  overflow: hidden;
}

.popup-bar {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.4s;
}

#popup-miles {
  font-size: 0.78rem;
  color: var(--text-lt);
  white-space: nowrap;
}

.popup-log-btn {
  display: block;
  text-align: center;
  background: var(--navy);
  color: var(--white);
  text-decoration: none;
  padding: 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s;
}

.popup-log-btn:hover { background: var(--navy-lt); }

/* =========================================================
   CURRENT STAGE BANNER
   ========================================================= */
.current-stage-banner.csb-bonus {
  background: linear-gradient(135deg, #7d3c98 0%, #9b59b6 100%);
}

.current-stage-banner {
  background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
  color: var(--white);
  padding: 12px 16px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.csb-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.75;
  margin-bottom: 3px;
}

.csb-route {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 9px;
}

.csb-bar-wrap {
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
  height: 5px;
  margin-bottom: 6px;
  overflow: hidden;
}

.csb-bar {
  background: var(--white);
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.csb-miles {
  font-size: 0.72rem;
  opacity: 0.85;
}

/* =========================================================
   SIDE PANEL
   ========================================================= */
.side-panel {
  background: var(--white);
  border-left: 1px solid #dde;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-lt);
  font-weight: 600;
  margin-bottom: 12px;
}

/* Thermometer card */
.thermo-card {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--grey-lt);
}

.miles-counter {
  text-align: center;
  margin-bottom: 14px;
}

.miles-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--navy);
  display: block;
  line-height: 1;
}

.miles-label {
  font-size: 0.8rem;
  color: var(--text-lt);
  margin-top: 4px;
  display: block;
}

/* Thermometer visual */
.thermometer-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  justify-content: center;
  margin-bottom: 10px;
}

.thermo-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 160px;
  text-align: right;
  font-size: 0.65rem;
  color: var(--text-lt);
}

.thermo-tube {
  width: 30px;
  height: 160px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.thermo-fill-wrap {
  width: 18px;
  height: 148px;
  background: var(--grey-lt);
  border-radius: 9px 9px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 2px solid #ccd;
}

.thermo-fill {
  width: 100%;
  background: linear-gradient(to top, var(--navy), var(--navy-lt), var(--orange));
  border-radius: 7px 7px 0 0;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thermo-bulb {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dk));
  border-radius: 50%;
  margin-top: auto;
  border: 2px solid #ccd;
  box-shadow: 0 2px 6px rgba(244,121,32,0.4);
}

.overall-pct {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
}

/* Log miles CTA button under thermometer */
.log-miles-btn {
  display: block;
  text-align: center;
  background: var(--orange);
  color: var(--white);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 32px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 14px;
  transition: background 0.2s, transform 0.15s;
}

.log-miles-btn:hover {
  background: var(--orange-dk);
  transform: translateY(-1px);
}

/* Stage list in side panel */
.stage-list-card {
  padding: 10px 12px;
  flex: 1;
  overflow-y: auto;
}

.stage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stage-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.78rem;
}

.stage-list li:hover { background: var(--grey-lt); }

.stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stage-dot.not-started { background: var(--grey); }
.stage-dot.in-progress { background: var(--amber); }
.stage-dot.complete    { background: var(--green); }

.stage-list-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-list-miles {
  color: var(--text-lt);
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* =========================================================
   EXCESS MILES BADGES
   ========================================================= */
.excess-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
}

/* Compact version used inside stage list rows */
.excess-badge-sm {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 10px;
  padding: 0 5px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 3px;
  vertical-align: middle;
}

/* Row holding badge + "miles banked" label */
.excess-total-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.excess-total-label {
  font-size: 0.78rem;
  color: var(--text-lt);
}

/* Log history inside the stage info box */
.sib-history {
  margin-top: 10px;
  border-top: 1px solid #b3d4f5;
  padding-top: 8px;
}

.sib-history-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-lt);
  margin-bottom: 6px;
}

.sib-history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 130px;
  overflow-y: auto;
}

.sib-history-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78rem;
  padding: 3px 0;
  border-bottom: 1px solid #e8f0f8;
}

.sib-history-item:last-child { border-bottom: none; }

.sib-history-miles {
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
  min-width: 40px;
}

.sib-history-note {
  flex: 1;
  color: var(--text-lt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.sib-history-date {
  color: var(--text-lt);
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Make the sib-excess-row match other sib-rows */
#sib-excess-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 4px;
}

/* =========================================================
   LOG PAGE
   ========================================================= */
.log-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
  align-items: start;
}

.log-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
}

.log-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.log-intro {
  font-size: 0.88rem;
  color: var(--text-lt);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Auth notice */
.auth-notice {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #6d4c00;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* Form */
.log-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.optional { font-weight: 400; color: var(--text-lt); font-size: 0.8rem; }

.form-group select,
.form-group textarea {
  border: 1.5px solid #dde;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s;
  background: var(--white);
}

.form-group select:focus,
.form-group textarea:focus,
.miles-input-wrap input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(6,81,108,0.12);
}

.miles-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #dde;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.miles-input-wrap input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
}

.miles-unit {
  padding: 0 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-lt);
  background: var(--grey-lt);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid #dde;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-lt);
  margin-top: 2px;
}

/* Stage info box */
.stage-info-box {
  background: #f0f7ff;
  border: 1.5px solid #b3d4f5;
  border-radius: 8px;
  padding: 12px 16px;
}

.sib-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 4px;
}

.sib-label { color: var(--text-lt); }

.sib-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.sib-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.sib-bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s;
}

#sib-pct { font-size: 0.75rem; color: var(--text-lt); }

/* Privacy notice */
.privacy-notice {
  background: #f5f7f9;
  border: 1px solid #d8dde3;
  border-left: 4px solid var(--navy);
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 20px;
  font-size: 0.78rem;
  color: #4a5568;
  line-height: 1.55;
}

.privacy-notice-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
  margin-bottom: 6px;
}

.privacy-notice ul {
  margin: 8px 0 10px 0;
  padding-left: 18px;
}

.privacy-notice li {
  margin-bottom: 6px;
}

.privacy-notice-confirm {
  font-style: italic;
  color: var(--text-lt);
  margin-top: 8px;
}

/* Submit */
.form-actions { margin-top: 16px; }

.submit-btn {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 13px 32px;
  border-radius: 32px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  letter-spacing: 0.3px;
}

.submit-btn:hover {
  background: var(--orange-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244,121,32,0.4);
}

.submit-btn:active { transform: none; }

.form-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.form-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Log sidebar */
.log-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.log-sidebar-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.log-sidebar-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-lt);
  font-weight: 600;
  margin-bottom: 14px;
}

.log-stage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
}

.log-stage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.log-stage-item .stage-dot { flex-shrink: 0; }

.log-stage-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-stage-num {
  color: var(--text-lt);
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* Total card */
.total-card { text-align: center; }

.total-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.total-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--navy);
}

.total-of { font-size: 0.9rem; color: var(--text-lt); }

.total-bar-wrap {
  height: 10px;
  background: var(--grey-lt);
  border-radius: 5px;
  overflow: hidden;
}

.total-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--orange));
  border-radius: 5px;
  transition: width 0.6s ease;
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 16px;
  font-size: 0.8rem;
  margin-top: auto;
}

/* =========================================================
   HAMBURGER BUTTON
   ========================================================= */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--white);
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   MOBILE STICKY LOG FAB (home page only)
   ========================================================= */
.mobile-log-fab {
  display: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }

  #map { min-height: 400px; }

  .side-panel {
    border-left: none;
    border-top: 1px solid var(--grey-lt);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .thermo-card { flex: 0 0 200px; }

  .log-layout {
    grid-template-columns: 1fr;
  }

  .log-sidebar { order: -1; }
  .log-stage-list { max-height: 200px; }
}

@media (max-width: 600px) {
  .header-brand h1 { font-size: 1.1rem; }
  .header-sub { display: none; }
  .log-card { padding: 20px; }
}

@media (max-width: 768px) {
  /* --- Hamburger + nav overlay --- */
  .hamburger { display: flex; }

  .site-nav {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 8px 16px 16px;
    gap: 4px;
    z-index: 999;
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .site-nav.open { display: flex; }

  .nav-link {
    padding: 12px 16px;
    border-radius: 8px;
    width: 100%;
    text-align: left;
  }

  /* --- Home: simplify layout --- */
  #map { min-height: 50vh; }

  /* Compact progress strip — hide the thermometer visual */
  .side-panel { flex-direction: column; }
  .thermo-card { flex: none; padding: 14px 16px 10px; }
  .thermometer-wrap { display: none; }
  .miles-number { font-size: 1.6rem; }
  .miles-counter { margin-bottom: 4px; }
  .overall-pct { margin-bottom: 6px; }

  /* Hide stage list on home page — map click handles it */
  .stage-list-card { display: none; }

  /* Space for sticky FAB */
  .home-layout { margin-bottom: 80px; }

  /* Stage popup: bottom sheet anchored to map area */
  .stage-popup {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    border-radius: 12px 12px 0 0;
    border-left: none;
    border-bottom: 4px solid var(--green);
  }

  /* --- Sticky Log FAB --- */
  .mobile-log-fab {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    padding: 10px 16px 20px;
    background: linear-gradient(to top, #f0f2f5 65%, transparent);
    pointer-events: none;
  }

  .mobile-log-fab a {
    display: block;
    text-align: center;
    background: var(--orange);
    color: var(--white);
    text-decoration: none;
    padding: 15px;
    border-radius: 32px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(244,121,32,0.45);
    pointer-events: all;
    transition: background 0.2s;
  }

  .mobile-log-fab a:hover { background: var(--orange-dk); }

  /* --- Log page: hide sidebar, full width --- */
  .log-sidebar { display: none; }
  .log-layout { margin: 12px auto; padding: 0 12px; }
  .log-card { padding: 20px 16px; }

  /* Prevent iOS zoom on tap (inputs must be 16px+) */
  .form-group input,
  .form-group select,
  .form-group textarea,
  .miles-input-wrap input { font-size: 16px; }

  /* Bigger submit button touch target */
  .submit-btn { padding: 15px; font-size: 1rem; }
}

/* =========================================================
   PHOTO LIGHTBOX (admin only — for viewing legacy entry photos)
   ========================================================= */
.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.photo-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--white);
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-body {
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  text-align: center;
}

.login-icon {
  font-size: 2.4rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 0.88rem;
  color: var(--text-lt);
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input {
  width: 100%;
  border: 1.5px solid #dde;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(6,81,108,0.12);
}

.login-btn {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 13px 32px;
  border-radius: 32px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.login-btn:hover {
  background: var(--orange-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244,121,32,0.4);
}

.login-error {
  font-size: 0.85rem;
  color: #721c24;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 10px;
  margin: 0;
}

/* =========================================================
   ADMIN PAGE
   ========================================================= */
.admin-layout {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 24px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--grey-lt);
  padding-bottom: 0;
}

.admin-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-lt);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tab.active {
  color: var(--navy);
  border-bottom-color: var(--orange);
}

.admin-tab-badge {
  background: var(--orange);
  color: var(--white);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.admin-panel { }

.admin-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-lt);
  font-size: 0.95rem;
}

.admin-entry-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-entry-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  transition: opacity 0.25s, transform 0.25s;
}

.entry-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.entry-name {
  font-size: 0.95rem;
  color: var(--navy);
}

.entry-miles {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--orange);
}

.entry-date {
  font-size: 0.78rem;
  color: var(--text-lt);
  white-space: nowrap;
}

.entry-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: capitalize;
}

.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.status-pending  { background: #fff3cd; color: #856404; }

.entry-note {
  font-size: 0.85rem;
  color: var(--text);
  font-style: italic;
  margin-bottom: 10px;
  line-height: 1.5;
}

.entry-photo-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.entry-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s;
}

.entry-thumb:hover { transform: scale(1.05); }

.entry-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.entry-btn {
  padding: 7px 18px;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.entry-btn:hover { opacity: 0.85; }

.approve-btn { background: #d4edda; color: #155724; }
.reject-btn  { background: #f8d7da; color: #721c24; }
.delete-btn  { background: var(--grey-lt); color: var(--text); }

/* Delete confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  padding: 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.modal-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--text-lt);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-cancel {
  padding: 10px 24px;
  background: var(--grey-lt);
  color: var(--text);
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.modal-confirm {
  padding: 10px 24px;
  background: #e74c3c;
  color: var(--white);
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* =========================================================
   ACTIVITY FEED PAGE
   ========================================================= */
.activity-layout {
  max-width: 680px;
  margin: 32px auto;
  padding: 0 24px;
}

.activity-header {
  margin-bottom: 24px;
}

.activity-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.activity-header p {
  font-size: 0.88rem;
  color: var(--text-lt);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.activity-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.activity-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.activity-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-card-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-name {
  font-size: 0.95rem;
  color: var(--navy);
}

.activity-date {
  font-size: 0.75rem;
  color: var(--text-lt);
}

.activity-miles-badge {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--orange);
  flex-shrink: 0;
}

.activity-note {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
  font-style: italic;
  margin-bottom: 10px;
}

.activity-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-lt);
}

.activity-empty p { margin-bottom: 20px; font-size: 0.95rem; }

.activity-log-btn {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  text-decoration: none;
  padding: 10px 28px;
  border-radius: 32px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.activity-log-btn:hover { background: var(--orange-dk); }

.activity-loading, .activity-error {
  text-align: center;
  padding: 40px;
  color: var(--text-lt);
  font-size: 0.9rem;
}

