* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px; background: #f7f6f3; color: #1a1a1a; padding: 2rem;
}

h1 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
h2.section-hdr {
  font-size: 13px; font-weight: 500; margin: 2rem 0 0.8rem;
  color: #555; border-top: 1px solid #ddd; padding-top: 1.5rem;
}

a { color: #2d5e6e; text-decoration: none; }
a:hover { color: #111; text-decoration: none; }

td.hl:hover { background: #f0efeb; }

.page-header { margin-bottom: 0.5rem; }
.sub { color: #666; font-size: 12px; margin-bottom: 3px; }
.no-data { color: #b00; }

.legend {
  display: flex; gap: 20px; font-size: 11px; color: #555; align-items: center;
}
.ld {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 4px; vertical-align: middle;
}
.ld.av { background: #1db87c; border: 1.5px solid #128a58; }
.ld.wu { background: #edca9e; border: 1.5px solid #cc9e62; }
.ld.bk { background: #ccc; border: 1.5px solid #aaa; }
.site-nav {
  display: flex; gap: 20px; margin-bottom: 1.75rem;
  border-bottom: 1px solid #e0ded8; padding-bottom: 10px;
}
.nav-link {
  font-size: 12px; color: #999; text-decoration: none;
}
.nav-link:hover { color: #333; }
.nav-link.active { color: #1a1a1a; font-weight: 500; }

.nav-dropdown {
  position: relative;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: -10px;
  background: #fff;
  border: 1px solid #e0ded8;
  border-radius: 4px;
  padding: 4px 0;
  min-width: 140px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}
.nav-dropdown-menu a {
  display: block;
  padding: 5px 12px;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: #f7f6f3; color: #1a1a1a; }

.fetch-nav {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: baseline;
}
.fetch-nav-label {
  font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 0.04em;
  margin-right: 2px; align-self: center;
}
.fetch-link {
  font-size: 11px; color: #999; text-decoration: none;
  white-space: nowrap; line-height: 1.5; padding: 0;
}
a.fetch-link:hover { color: #333; }
.fetch-link.active {
  color: #1a1a1a; font-weight: 500; cursor: default;
  border: 1.5px solid #888; border-radius: 3px;
  padding: 1px 8px; background: #fff;
}

.ct {
  font-size: 12px; padding: 2px 8px 2px 0; text-align: right;
  border-bottom: 1px solid #f0efeb; color: #333;
}
.ct.hdr { font-size: 10px; font-weight: 500; color: #888; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
.camp-row:hover .ct { background: #f0efeb; }

.fetch-btn {
  font-size: 12px; padding: 4px 14px; border: 1px solid #bbb;
  background: #efefeb; cursor: pointer; border-radius: 3px; color: #333;
}
.fetch-btn:hover:not(:disabled) { background: #e4e4e0; border-color: #999; }
.fetch-btn:disabled { color: #bbb; border-color: #e0e0e0; background: #f5f5f3; cursor: not-allowed; }

.status-msg {
  font-size: 12px; margin-bottom: 1rem; padding: 6px 10px;
  background: #e8f4f7; border: 1px solid #b0d4dd; border-radius: 3px; color: #2d5e6e;
  width: fit-content;
}
.status-msg a { color: #2d5e6e; }

/* Heatmap table */
.wrap { overflow-x: auto; margin-bottom: 1rem; transform: translateZ(0); padding-bottom: 14px; }
table { border-collapse: separate; border-spacing: 0; white-space: nowrap; }
.wrap table { border: 1px solid #ddd; }

.cn {
  font-size: 12px; padding: 2px 10px 2px 8px; white-space: nowrap;
  position: sticky; left: 0; background: #f7f6f3; z-index: 3; min-width: 170px;
  text-align: left; border-right: 1px solid #ddd;
}
thead th.cn { z-index: 4; }
.cn.hdr { font-size: 10px; font-weight: 500; color: #888; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid #ddd; }
.cn.th { font-weight: normal; }

.mhdr {
  font-size: 10px; font-weight: 500; color: #888; text-align: center;
  border-left: 1px solid #ddd; padding: 5px 4px; text-transform: uppercase; letter-spacing: 0.03em;
}
.cn + .mhdr { border-left: none; }
.dhdr {
  font-size: 9px; color: #bbb; text-align: center;
  width: 16px; min-width: 16px; padding: 3px 0;
  border-bottom: 1px solid #ddd;
}
.dhdr.we { color: #ccc; }
.dhdr.mon { color: #999; border-left: 1px solid #ddd; }

.c {
  width: 16px; min-width: 16px; height: 18px; text-align: center;
  vertical-align: middle; padding: 0;
}
.c.mn { border-left: 1px solid #e5e4de; }

.dot { width: 8px; height: 8px; border-radius: 50%; margin: auto; }
.dot.av { background: #1db87c; border: 1.5px solid #128a58; }
.dot.wu { background: #edca9e; border: 1.5px solid #cc9e62; }
.dot.bk { background: #ccc; border: 1.5px solid #aaa; }

tbody tr:hover .c { background: #e8e7e1 !important; }
tbody tr:hover .cn { font-weight: normal; background: #e8e7e1 !important; }
.col-hover { background: #dde8e3 !important; }

/* Walk-up section headings */
.wu-section-hdr {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: #555; margin: 24px 0 14px;
}
.wu-divider {
  border: none; border-top: 1px solid #e0ded8; margin: 8px 0 0;
}

/* Search / walk-up form controls */
.search-row { display:flex;flex-wrap:wrap;gap:16px;align-items:flex-end;margin-bottom:12px; }
.field-group { display:flex;flex-direction:column;gap:4px; }
.field-label { font-size:10px;font-weight:500;color:#888;text-transform:uppercase;letter-spacing:0.04em; }
.tog { font-size:12px;padding:5px 10px;border:1px solid #ccc;background:#fff;cursor:pointer;color:#666;border-radius:0; }
.tog:first-of-type { border-radius:3px 0 0 3px; }
.tog:last-of-type  { border-radius:0 3px 3px 0;margin-left:-1px; }
.tog + .tog        { margin-left:-1px; }
.tog.active        { background:#2d5e6e;border-color:#2d5e6e;color:#fff;z-index:1;position:relative; }
.tog:hover:not(.active) { background:#f0efeb;border-color:#bbb; }
.num-input {
  font-size:12px;padding:5px 8px;border:1px solid #ccc;border-radius:3px;
  width:70px;color:#333;background:#fff;accent-color:#2d5e6e;
}
.num-input:focus { outline:none;border-color:#2d5e6e; }
.date-input {
  font-size:12px;padding:5px 8px;border:1px solid #ccc;border-radius:3px;
  color:#333;background:#fff;
}
.date-input:focus { outline:none;border-color:#2d5e6e; }
.reset-link {
  font-size:11px;padding:0;border:none;background:none;
  color:#aaa;cursor:pointer;text-decoration:underline;
  font-family:inherit;appearance:none;
}
.reset-link:hover { color:#666; }
.search-btn {
  font-size:12px;padding:4px 18px;border:1px solid #2d5e6e;
  background:#2d5e6e;color:#fff;cursor:pointer;border-radius:3px;
}
.search-btn:hover { background:#234d5b;border-color:#234d5b; }
.inline-pair { display:flex;align-items:center;gap:4px; }
.inline-pair .sep { font-size:11px;color:#aaa; }

/* Search page */
.dir-badge {
  font-size: 10px; padding: 1px 7px; border-radius: 3px;
  font-weight: 500; letter-spacing: 0.03em; white-space: nowrap;
}
.dir-badge.cw  { background: #e0eff3; color: #2d5e6e; border: 1px solid #b0d4dd; }
.dir-badge.ccw { background: #ede8f5; color: #5b3a9e; border: 1px solid #c4b0e8; }
.sp-badge { font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 500; letter-spacing: 0.03em; background: #fdf3e3; color: #7a4f10; border: 1px solid #f0d098; margin-left: 4px; }

.date-header {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 12px; cursor: pointer; background: #f7f6f3;
  border: 1px solid #ddd; border-radius: 3px; margin-top: 6px;
  font-size: 12px; font-weight: 500; user-select: none;
}
.date-header:hover { background: #f0efeb; }
.date-header .count-badge { font-size: 11px; color: #888; font-weight: 400; }
.date-header .chevron { color: #aaa; font-size: 10px; margin-left: auto; transition: transform 0.15s; }
.date-header.open .chevron { transform: rotate(90deg); }
.date-header.open { border-radius: 3px 3px 0 0; }

.date-group { width: 598px; }
.itin-table { overflow-x: auto; }

.sort-th { cursor: pointer; user-select: none; }
.sort-th:hover { color: #555 !important; }
.sort-th.sort-active { color: #1a1a1a !important; }
.sort-ind { font-size: 9px; }

.itin-row { cursor: pointer; }
.itin-row td { transition: background 0.05s; }
.itin-row:hover td { background: #f0efeb !important; }
.itin-row.expanded td { background: #fff !important; border-bottom: 2px solid #a8cfc4 !important; }

.itin-day td { background: #fdf8ed; border-bottom: 1px solid #ede8df; color: #555; }
.itin-day-last td { border-bottom: 2px solid #d8d0c4 !important; }
.itin-day-hdr td { font-size: 9px; font-weight: 500; color: #aaa; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 10px 2px; border-bottom: 1px solid #e8e3d8; }

/* Planner two-column layout */
:root { --section-gap: 0.75rem; --planner-max-width: 1200px; }

.planner-grid {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: var(--section-gap);
  column-gap: 0;
  max-width: 660px;
  margin: 0 auto;
}
.planner-col-table, .planner-col-right { min-width: 0; }
.planner-summary-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #f7f6f3;
  padding-bottom: var(--section-gap);
}
.table-card {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  justify-self: stretch;
  width: 100%;
  background: #fff;
}
.planner-table-outer {
  position: relative;
  width: 100%;
}
.planner-table-outer::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(to right, rgba(255,255,255,0), #fff);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
}
.planner-table-outer.has-overflow-right::after { opacity: 1; }
.planner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px 10px;
  background: #fff;
  overflow-x: auto;
  flex-wrap: nowrap;
  position: relative;
  scrollbar-width: none;
}
.planner-actions button {
  white-space: nowrap;
  flex-shrink: 0;
}
.planner-actions::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(to right, rgba(255,255,255,0), #fff);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
}
.planner-actions.has-overflow-right::after { opacity: 1; }
#planner-table tbody tr { height: 24px; }
#planner-table tbody td { height: 24px; }

#trail-map { max-height: calc(100vh - 310px); min-height: 400px; }
.leaflet-container:focus,
.leaflet-container:focus-visible { outline: none; }
.leaflet-bar a:focus { outline: none; }
.leaflet-bar a:focus-visible { outline: 2px solid #2d5e6e; }
#map-wrap.map-fullwindow {
  z-index: 9999 !important; /* lift stacking context above sticky UI (z-index:30) */
}
#trail-map.map-fullwindow {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  max-height: none !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
}

@media (min-width: 740px) {
  .planner-grid {
    grid-template-columns: 395px minmax(280px, 1fr);
    grid-template-areas: "left right";
    column-gap: var(--section-gap);
    max-width: var(--planner-max-width);
    margin: 0 auto;
  }
  .planner-col-table {
    grid-area: left;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }
  .planner-col-right { grid-area: right; }
  .table-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .planner-table-outer {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .planner-table-outer > div:first-child {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  .planner-table-outer::before {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 24px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 5;
  }
  .planner-table-outer.has-overflow-bottom::before { opacity: 1; }
  #planner-table thead th { position: sticky; top: 0; z-index: 10; }
  /* grid items are BFCs; a trailing margin on the last child of .planner-col-right
     would inflate column height past the map's border — keep #map-wrap margin-free */
  #trail-map { height: clamp(284px, calc(100vh - 296px), 648px); max-height: none; min-height: auto; }

}

/* Scheduler log */
.run-badge {
  font-size: 10px; padding: 1px 7px; border-radius: 3px;
  font-weight: 500; letter-spacing: 0.03em; white-space: nowrap;
  border: 1px solid transparent; display: inline-block;
}
.run-badge.ok    { background: #1db87c; color: #fff;    border-color: #128a58; }
.run-badge.info  { background: #e0eff3; color: #2d5e6e; border-color: #b0d4dd; }
.run-badge.warn  { background: #fdf3e3; color: #7a4f10; border-color: #f0d098; }
.run-badge.err   { background: #fbe5e5; color: #a00;    border-color: #f0b0b0; }
.run-badge.skip  { background: #f0efeb; color: #888;    border-color: #ddd;    }

.sched-row:hover td { background: #f7f6f3; }
.json-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: #333; background: #fafaf7;
  padding: 8px 10px; border: 1px solid #e0ded8; border-radius: 3px;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  margin: 4px 0 0;
}
