:root {
  --bg: #f2f6f7;
  --panel: #ffffff;
  --ink: #11333f;
  --muted: #4a6b76;
  --brand: #005c86;
  --warn: #ae2b00;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background: radial-gradient(circle at top right, #d8ecef, var(--bg));
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}
a {
  color: var(--brand);
}
body.app-active {
  overflow: hidden;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  padding: .75rem;
}

body.app-active .app-shell {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.site-footer {
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
  margin-top: 1rem;
}

.site-footer a {
  text-decoration: none;
}

.footer-toggle-btn {
  position: fixed;
  left: .8rem;
  bottom: .8rem;
  z-index: 1105;
  width: 2.3rem;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #c5d9e2;
  background: #eef6f9;
  color: #123d4c;
  box-shadow: 0 8px 18px rgba(0, 24, 40, .2);
}

.footer-toggle-btn:hover {
  background: #e2eef3;
}

.footer-toggle-btn[aria-expanded="false"] {
  width: auto;
  min-width: 2.3rem;
  padding: 0 .55rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 1320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 28, 40, .55);
}

.legal-modal-card {
  position: relative;
  width: min(760px, 94vw);
  max-height: 86vh;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #cfe0e8;
  background: #fff;
  box-shadow: 0 20px 45px rgba(0, 24, 40, .28);
  padding: 1rem;
}

.legal-modal-close {
  position: absolute;
  top: .55rem;
  right: .55rem;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #c8dbe3;
  background: #edf4f7;
  color: #365766;
  font-size: 1.2rem;
  line-height: 1;
}

.legal-section h2 {
  margin: 0 0 .55rem;
  color: #0a3f58;
}

.legal-section + .legal-section {
  margin-top: .9rem;
  padding-top: .75rem;
  border-top: 1px solid #dce9ef;
}

.legal-list {
  margin: 0;
  padding-left: 1rem;
}

.legal-list li {
  margin-bottom: .4rem;
}

.footer-logout {
  width: auto;
  padding: .35rem .7rem;
}

.footer-refresh {
  width: auto;
  min-width: 2.1rem;
  padding: .35rem .45rem;
  border: 1px solid #c9d9e0;
  background: #eef5f8;
  color: #234350;
}

.footer-refresh:hover {
  background: #e3eef3;
  border-color: #b5cad4;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.topbar > .topbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.topbar-brand .app-logo {
  position: absolute;
  height: 3rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.3em;
  margin-left: 3.5rem;
}

.topbar-credit {
  margin-left: 6.2rem;
  margin-top: 2rem;
  font-size: .72rem;
  color: #7e8f96;
  text-decoration: none;
  line-height: 1;
  position: absolute;
}

.topbar-credit:hover {
  color: #5f757f;
  text-decoration: underline;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}

#sidebar-open-btn {
  width: auto;
  min-width: 2.5rem;
  padding: .45rem .65rem;
  font-size: 1.15rem;
  line-height: 1;
}

.mobile-menu-hint {
  position: fixed;
  top: 4.4rem;
  right: .8rem;
  z-index: 1200;
  background: #fff6d8;
  color: #6f4c00;
  border: 1px solid #eedaa0;
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .82rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 40, 60, .18);
}

.sponsor-splash {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 28, 40, .45);
}

.sponsor-splash-card {
  position: relative;
  width: min(720px, 94vw);
  border-radius: 12px;
  border: 1px solid #d7e5eb;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(0, 24, 40, .25);
  padding: .9rem;
  display: flex;
  flex-direction: column;
}

.sponsor-splash-title {
  margin: 0 0 .7rem;
  font-weight: 700;
  color: #0a3f58;
  padding-right: 2rem;
}

.sponsor-splash-close {
  position: absolute;
  top: .55rem;
  right: .55rem;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #c8dbe3;
  background: #edf4f7;
  color: #365766;
  font-size: 1.2rem;
  line-height: 1;
}

.sponsor-splash-close:hover {
  background: #e1edf2;
  border-color: #aac6d3;
}

.sponsor-splash-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .65rem;
}

.sponsor-splash-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border: 1px solid #deeaef;
  border-radius: 10px;
  background: #f8fcfd;
  padding: .5rem;
  text-decoration: none;
}

.sponsor-splash-link:hover {
  border-color: #9ec3d2;
  background: #eef6f9;
}

.sponsor-splash-link img {
  max-width: 100%;
  max-height: 52px;
  width: auto;
  height: auto;
  display: block;
}

.sponsor-more-btn {
  width: auto;
  align-self: flex-end;
  margin-top: .75rem;
  border: 1px solid #bfd6e0;
  background: #eef6f9;
  color: #0b4e66;
  padding: .45rem .8rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.sponsor-more-btn:hover {
  background: #e2eff4;
  border-color: #97bece;
}

.guidelines-splash {
  position: fixed;
  inset: 0;
  z-index: 1310;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 28, 40, .55);
}

.guidelines-splash-card {
  width: min(700px, 94vw);
  border-radius: 12px;
  border: 1px solid #cfe0e8;
  background: #fff;
  box-shadow: 0 20px 45px rgba(0, 24, 40, .28);
  padding: 1rem;
}

.guidelines-splash-card h2 {
  margin: 0 0 .7rem;
  color: #0a3f58;
}

.guidelines-list {
  display: grid;
  gap: .45rem;
  margin-bottom: .6rem;
}

.guidelines-list p {
  margin: 0;
  line-height: 1.35;
  background: #f4fafc;
  border: 1px solid #d9e9ef;
  border-radius: 9px;
  padding: .48rem .58rem;
}

.guidelines-list i {
  display: inline-block;
  color: #005c86;
  margin-right: .5rem;
  vertical-align: baseline;
}

.guidelines-splash-card small {
  display: block;
  color: #4a5d66;
  margin-bottom: .8rem;
}

.guidelines-splash-card small i {
  color: #005c86;
}

@keyframes menu-button-wiggle {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

h1 {
  margin: 0;
}

.subline {
  margin: .2rem 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border-radius: 12px;
  /* padding: 1rem; */
  box-shadow: 0 15px 40px rgba(0, 40, 60, .08);
  margin-top: 1rem;
}

#app-panel {
  height: auto;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

label {
  display: block;
  margin-bottom: .8rem;
}

input, select, button {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #bfd4db;
  padding: .65rem;
  font: inherit;
}

button {
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
}

button.ghost {
  background: #e9f1f4;
  color: var(--ink);
}

#toggle-targets-btn {
  background: #fdeff0;
  border: 1px solid #f2c9cd;
  color: #8e2f38;
}

#toggle-targets-btn:hover {
  background: #f9e2e4;
  border-color: #eab9be;
}

.admin-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.admin-badge {
  background: #005c86;
  color: #fff;
  border-radius: 999px;
  font-size: .75rem;
  line-height: 1;
  padding: .28rem .45rem;
  min-width: 1.5rem;
  text-align: center;
}

.row {
  display: flex;
  gap: .6rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: .8rem;
  flex: 1;
  min-height: 0;
  height: 100%;
  position: relative;
}

#map {
  height: 100%;
  min-height: 400px;
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
}

.map-alert {
  position: absolute;
  top: .65rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 700;
  display: block;
  width: min(640px, calc(100% - 1.2rem));
  padding: .2rem .2rem .2rem .2rem;
  border-radius: 12px;
  border: 2px solid #e2b02e;
  background: rgba(255, 247, 212, .95);
  color: #553d00;
  box-shadow: 0 9px 20px rgba(80, 57, 0, .2);
  animation: map-alert-pulse 1.8s ease-in-out infinite;
}

.map-alert.map-alert--danger {
  border-color: #d97b00;
  background: rgba(255, 235, 199, .96);
  color: #613400;
  animation-duration: 1.4s;
}

.map-alert-text {
  margin: 0;
  display: block;
  width: 100%;
  font-size: .93rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: pre-line;
}

.route-info-box {
  position: absolute;
  left: 50%;
  bottom: .8rem;
  transform: translateX(-50%);
  z-index: 710;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  width: min(430px, calc(100% - 1.2rem));
  padding: .3rem .35rem .3rem .55rem;
  border-radius: 12px;
  border: 1px solid #b8d0db;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 18px rgba(0, 40, 60, .2);
  width: auto;
  white-space: nowrap;
}

.route-info-text {
  margin: 0;
  font-size: .92rem;
  font-weight: 700;
  color: #123a4a;
}

.route-info-text small {
  font-size: .72em;
  color: #5d7682;
  font-weight: 600;
}

#route-info-close {
  width: auto;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #f0c0c5;
  background: #fdeff0;
  color: #8e2f38;
}

#route-info-close:hover {
  background: #f9e2e4;
  border-color: #eab9be;
}

#map-alert-close {
  position: absolute;
  top: -.7rem;
  right: -.7rem;
  width: auto;
  min-width: 2rem;
  padding: .28rem .42rem;
  background: rgba(255, 158, 158, 0.6);
  border: 1px solid rgba(134, 89, 0, .35);
  color: #7a4f00;
}

#map-alert-close:hover {
  background: rgba(255, 205, 205, 0.85);
}

@keyframes map-alert-pulse {
  0%,
  100% {
    box-shadow: 0 9px 20px rgba(80, 57, 0, .2);
    border-color: #e2b02e;
  }
  50% {
    box-shadow: 0 10px 22px rgba(80, 57, 0, .27);
    border-color: #e8ba43;
  }
}

.leaflet-container {
  width: 100%;
  height: 100%;
}

.leaflet-control-layers-expanded {
  padding: .35rem .45rem;
  min-width: 140px;
}

.leaflet-control-layers-list {
  margin: 0;
}

.leaflet-control-layers-base label {
  margin: 0;
  padding: .12rem 0;
}

.leaflet-control-layers-base label > span {
  display: flex;
  align-items: stretch;
  font-size: .82rem;
  line-height: 1.2;
  width: 100%;
  position: relative;
}

.leaflet-control-layers-base label > span > input.leaflet-control-layers-selector {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.leaflet-control-layers-base label > span > span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: .36rem .55rem;
  border: 1px solid #b8c9d1;
  border-radius: 8px;
  background: #f7fbfd;
  color: #35525f;
  text-align: left;
  white-space: nowrap;
}

.leaflet-control-layers-base label > span > input.leaflet-control-layers-selector:checked + span {
  background: #2f4b57;
  border-color: #2f4b57;
  color: #fff;
}

.leaflet-control-layers-base label > span > input.leaflet-control-layers-selector:focus-visible + span {
  outline: 2px solid #1a7aa5;
  outline-offset: 1px;
}

.map-follow-btn {
  width: auto;
  min-width: 10.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .4rem .6rem;
  border: 1px solid #c1d6de;
  background: #f3f8fa;
  color: #2f4b57;
  font-size: .82rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 20, 35, .14);
  transition: min-width .22s ease, padding .22s ease, background-color .18s ease;
}

.leaflet-top.leaflet-left .map-position-btn {
  margin-top: 54px;
  width: 2.2rem;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #c1d6de;
  background: #f3f8fa;
  color: #3f4d54;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 20, 35, .14);
}

.leaflet-top.leaflet-left .map-position-btn.is-active {
  background: #005c86;
  border-color: #005c86;
  color: #fff;
}

.leaflet-top.leaflet-left .map-position-btn:hover {
  background: #e8f1f4;
}

.leaflet-top.leaflet-left .map-position-btn.is-active:hover {
  background: #004a6c;
}

.leaflet-top.leaflet-left .map-position-hint {
  position: absolute;
  top: 9rem;
  left: 2.65rem;
  max-width: 180px;
  padding: .42rem .56rem;
  border-radius: 10px;
  border: 1px solid #c2d8e2;
  background: rgba(255, 255, 255, .96);
  color: #345560;
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: pre-line;
  box-shadow: 0 6px 14px rgba(0, 24, 40, .16);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.leaflet-top.leaflet-left .map-position-hint::before {
  content: '';
  position: absolute;
  top: 12px;
  left: -6px;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, .96);
  border-left: 1px solid #c2d8e2;
  border-top: 1px solid #c2d8e2;
  transform: rotate(45deg);
}

.leaflet-top.leaflet-left .map-position-hint.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.leaflet-top.leaflet-left .map-position-hint.is-fading {
  opacity: 0;
  transform: translateX(-3px);
}

.leaflet-top.leaflet-left .map-position-btn.is-armed {
  border-color: #7daec4;
  box-shadow: 0 0 0 0 rgba(0, 92, 134, .32);
  animation: position-arm-pulse .9s ease-out infinite;
}

@keyframes position-arm-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 92, 134, .32);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(0, 92, 134, 0);
  }
}

.map-follow-btn.is-icon-only {
  min-width: 2.2rem;
  padding: .4rem .5rem;
  padding-right: 0;
}

.map-follow-btn span {
  display: inline-block;
  max-width: 9.5rem;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .22s ease, opacity .18s ease;
}

.map-follow-btn.is-icon-only span {
  max-width: 0;
  opacity: 0;
}

.map-follow-btn.is-active {
  background: #2f4b57;
  border-color: #2f4b57;
  color: #fff;
}

.map-follow-btn:hover {
  background: #e8f1f4;
}

.map-follow-btn.is-active:hover {
  background: #26414b;
}

.tasks {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid #d8e5ea;
  border-radius: 12px;
  overflow: hidden;
}

.tasks-tabs {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem;
  border-bottom: 1px solid #d8e5ea;
  background: #f4fafc;
}

.tasks-tab {
  width: auto;
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: .7rem;
  font-weight: 700;
  color: #4b6772;
  background: transparent;
}

.tasks-tab.is-active {
  background: #fff;
  color: #11333f;
}

.tasks-tabs #toggle-targets-btn {
  width: auto;
  min-width: 2.3rem;
  padding: .45rem .55rem;
  flex: 0 0 auto;
}

.tasks-tab-panels {
  flex: 1;
  min-height: 0;
  display: block;
}

.tasks-tab-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.tasks-app-controls {
  display: grid;
  gap: .5rem;
  padding: .7rem;
  border-bottom: 1px solid #e5eef1;
}

.tasks-app-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  padding: .25rem;
  border: 1px solid #cddde4;
  border-radius: 10px;
  background: #eef5f8;
}

.tasks-app-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: transparent;
  color: #4b6772;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: .5rem;
}

.tasks-app-view-btn.is-active {
  background: #ffffff;
  color: #005c86;
  border-color: #a9c7d3;
  box-shadow: 0 1px 4px rgba(0, 40, 60, .12);
}

.tasks-targets-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.tasks-guide-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: .65rem;
  gap: .5rem;
}

.tasks-guide-jump {
  flex-shrink: 0;
}

#guest-tasks-inline-list {
  border: 1px solid #d8e5ea;
  border-radius: 10px;
  background: #f8fcfd;
  padding: .55rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.tasks-ride-select-block {
  display: grid;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid #e5eef1;
}

.tasks-ride-select-label {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  color: #58757f;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.tasks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.tasks-header {
  position: relative;
  display: block;
  padding: .75rem .8rem .65rem;
  border-bottom: 1px solid #e5eef1;
  flex-shrink: 0;
}

.tasks-header h2 {
  margin: 0;
  width: 100%;
  font-size: 1.1rem;
  padding-top: 0;
}

#tasks-back-btn[hidden] + #tasks-title {
  padding-bottom: 0;
}

.tasks-map-hint {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}

#tasks-back-btn {
  width: auto;
  padding: .38rem .58rem;
  flex-shrink: 0;
  position: absolute;
  right: .8rem;
  bottom: -1.3rem;
  z-index: 3;
  background: #fff6d8;
  border: 1px solid #ecd89a;
  color: #7a5b00;
}

#tasks-back-btn:hover {
  background: #ffefbc;
  border-color: #e3cb80;
}

.tasks-admin-actions {
  display: grid;
  gap: .4rem;
  padding: .7rem;
  border-bottom: 1px solid #e5eef1;
}

.admin-swiper {
  flex: 1;
  min-height: 0;
}

.admin-swiper-page {
  min-height: 0;
}

.admin-swiper-page--menu,
.admin-swiper-page--detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tasks-admin-actions .admin-menu-item {
  width: 100%;
}

#tasks-admin-panel-host {
  min-height: 0;
}

#ride-info {
  margin: 0;
  padding: .65rem .8rem;
  border-top: 1px solid #e5eef1;
  background: #f8fcfd;
  font-size: .85rem;
}

.tasks .task-group-card {
  list-style: none;
  border: 1px solid #e5eef1;
  border-left: 4px solid var(--task-color, #e5eef1);
  border-top: 2px solid var(--task-color, #e5eef1);
  border-radius: 10px;
  margin: 0 0 .6rem;
  background: #fff;
}

.tasks .task-group-header {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: .5rem;
  align-items: center;
  padding: .55rem .7rem;
  border-bottom: 1px solid #eef3f5;
  background: #f8fcfd;
  border-radius: 6px 6px 0 0;
}

.tasks .task-group-info {
  width: auto;
  padding: .25rem .4rem;
  line-height: 1;
  background: #e7f6ee;
  border: 1px solid #bfe4cf;
  color: #1f6a45;
}

.tasks .task-group-info:hover {
  background: #dcf1e7;
  border-color: #addabc;
}

.tasks .task-group-num {
  font-weight: 700;
}

.tasks .task-group-code {
  font-weight: 600;
}

.tasks .is-clickable {
  text-decoration: underline;
  cursor: pointer;
}

.tasks .task-group-rows {
  display: flex;
  flex-direction: column;
}

.tasks .task-group-row {
  display: grid;
  grid-template-columns: 56px 1fr 56px auto;
  gap: .5rem;
  align-items: center;
  padding: .5rem .7rem;
  cursor: pointer;
  border-top: 1px solid #f1f5f7;
}

.tasks .target-row-num {
  color: transparent;
}

.tasks .target-point {
  color: var(--muted);
  font-size: .85rem;
}

.tasks .target-mma {
  color: var(--muted);
  font-size: .85rem;
  text-align: right;
}

.tasks .target-actions {
  display: flex;
  justify-content: flex-end;
  gap: .25rem;
}

.tasks .target-actions button {
  width: auto;
  padding: .25rem .4rem;
  font-size: .9rem;
}

.tasks .target-actions .btn-route,
.tasks .target-actions .btn-gmap {
  background: #e7f6ee;
  border: 1px solid #bfe4cf;
  color: #1f6a45;
}

.tasks .target-actions .btn-route:hover,
.tasks .target-actions .btn-gmap:hover {
  background: #dcf1e7;
  border-color: #addabc;
}

.tasks .target-actions .btn-route.is-loading {
  opacity: .6;
}

.tasks .target-actions .btn-route.is-loading i {
  display: inline-block;
  animation: route-spin .9s linear infinite;
}

#detail-route-btn.is-loading i {
  display: inline-block;
  animation: route-spin .9s linear infinite;
}

@keyframes route-spin {
  to {
    transform: rotate(360deg);
  }
}

.target-detail-view {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-left: 1rem;
  margin-right: 1rem;
}

.target-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
}

.target-detail-title {
  margin: 0;
  font-size: 1rem;
}

.target-detail-image {
  margin: .5rem 0;
}

.target-detail-image img,
.target-detail-image svg {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
}

.target-detail-description {
  font-size: .9rem;
  line-height: 1.5;
}

.target-detail-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: nowrap;
}

.target-detail-actions button {
  width: auto;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}

.hint {
  color: var(--muted);
}

.admin-panel {
  margin-top: .8rem;
  display: grid;
  gap: .8rem;
}

.admin-card {
  background: #f7fbfc;
  border: 1px solid #d5e5eb;
  border-radius: 12px;
  padding: .8rem;
  z-index: 1000;
}

.admin-card h2 {
  margin: 0;
}

.admin-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .5rem;
  margin: -.8rem -.8rem .7rem;
  padding: .75rem .8rem .65rem;
  border-bottom: 1px solid #d8e5ea;
}

.admin-card-head h2 {
  width: 100%;
  font-size: 1.1rem;
}

.admin-card-actions {
  display: flex;
  gap: .4rem;
}

.admin-back-btn {
  width: auto;
  min-width: 3em;
  padding: .38rem .55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  background: #fff3d6;
  border: 1px solid #e5c97b;
  color: #7a5b00;
}

.admin-back-btn:hover {
  background: #ffecbf;
  border-color: #d9ba63;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .6rem;
  margin-bottom: .7rem;
}

#admin-ride-create-form {
  grid-template-columns: 1fr;
  gap: .45rem;
  margin-bottom: .45rem;
}

#admin-ride-create-form input,
#admin-ride-create-form select,
#admin-ride-create-form button {
  padding: .52rem;
}

#admin-rides-tab-rides {
  display: grid;
  gap: .45rem;
}

#admin-rides-tab-rides .admin-table-wrap {
  margin-top: 0;
}

.guest-tasks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .6rem;
}

.guest-task-card {
  border: 1px solid #dfecef;
  border-radius: 10px;
  padding: .65rem;
  background: #fff;
  scroll-margin-top: 8px;
}

.guest-task-visual {
  margin: .5rem 0;
  border: 1px solid #e6eff2;
  border-radius: 8px;
  padding: .35rem;
  min-height: 84px;
  background: #f8fcfd;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guest-task-visual svg,
.guest-task-visual img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 120px;
}

#guest-tasks-modal {
  width: min(1080px, 94vw);
  max-height: 86vh;
}

#guest-tasks-modal::backdrop {
  background: rgba(0, 28, 46, .45);
}

.guest-task-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.guest-task-tag {
  border-radius: 999px;
  padding: .15rem .5rem;
  font-size: .75rem;
  background: #d9ebf2;
  color: #0b4e66;
}

.guest-task-tag.info {
  background: #fff3d6;
  color: #7a5100;
}

.admin-table-wrap {
  overflow: auto;
}

.admin-global-waypoints-wrap {
  max-height: 320px;
  overflow-y: auto;
}

.admin-waypoints-wrap {
  max-height: 320px;
  overflow-y: auto;
}

.admin-global-waypoints-actions {
  margin-top: .55rem;
  display: flex;
  justify-content: flex-end;
}

.admin-waypoints-actions {
  margin-top: .55rem;
  display: flex;
  justify-content: flex-end;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #dfecef;
  text-align: left;
  padding: .45rem;
  vertical-align: middle;
}

.admin-table td input,
.admin-table td select,
.admin-table td button {
  min-width: 80px;
  width: auto;
}

.admin-rides-table td input,
.admin-rides-table td select {
  width: 100%;
}

.admin-rides-table th,
.admin-rides-table td {
  padding: .38rem .42rem;
}

.admin-table .admin-actions {
  display: flex;
  gap: .4rem;
  justify-content: space-between;
  align-items: center;
}

.admin-table .admin-actions .btn-save-ride {
  margin-left: auto;
}

.admin-table .admin-actions .btn-delete-ride {
  background: #fdeff0;
  border: 1px solid #f2c9cd;
  color: #8e2f38;
}

.admin-table .admin-actions .btn-delete-ride:hover {
  background: #f9e2e4;
  border-color: #eab9be;
}

.admin-gpx-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: .6rem;
  align-items: end;
}

.admin-waypoint-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: .6rem;
  align-items: end;
  margin-bottom: .7rem;
}

.admin-tab-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .4rem;
  margin-bottom: .7rem;
  padding: .25rem;
  border: 1px solid #cddde4;
  border-radius: 10px;
  background: #eef5f8;
}

.admin-tab-row .admin-rides-tab-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: transparent;
  color: #4b6772;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: .5rem;
}

.admin-tab-row .admin-rides-tab-btn.is-active {
  background: #ffffff;
  color: #005c86;
  border-color: #a9c7d3;
  box-shadow: 0 1px 4px rgba(0, 40, 60, .12);
}

.admin-target-row {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 1fr 1fr 1fr auto;
  gap: .5rem;
  margin-bottom: .5rem;
  align-items: center;
}

.admin-existing-targets {
  background: #f0f7fa;
  border: 1px solid #d5e5eb;
  border-radius: 8px;
  padding: .75rem;
  margin-bottom: .75rem;
}

.admin-existing-targets-list {
  display: grid;
  gap: .45rem;
  margin-top: .5rem;
  max-height: 200px;
  overflow-y: auto;
}

.admin-existing-target-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: .5rem;
  align-items: center;
  background: #fff;
  border: 1px solid #e0eaf0;
  border-radius: 6px;
  padding: .45rem .6rem;
  font-size: .9rem;
}

.admin-existing-target-item .waypoint-label {
  flex: 1;
}

.admin-existing-target-item .delete-all-btn {
  color: #ae2b00;
  padding: .2rem .4rem;
  font-size: .8rem;
}

.waypoint-marker {
  background: transparent;
}

.waypoint-marker .waypoint-inner {
  width: 20px;
  height: 20px;
  background: #ff6b00 !important;
  border: 3px solid #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
  display: block !important;
}

.leaflet-marker-icon {
  background: transparent !important;
  border: none !important;
}

.leaflet-interactive.current-position-pulse {
  transform-box: fill-box;
  transform-origin: center center;
  animation: current-position-pulse 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes current-position-pulse {
  0% {
    stroke-opacity: .6;
    fill-opacity: .2;
    transform: scale(1);
  }
  70% {
    stroke-opacity: 0;
    fill-opacity: 0;
    transform: scale(1.85);
  }
  100% {
    stroke-opacity: 0;
    fill-opacity: 0;
    transform: scale(1.85);
  }
}

.leaflet-tooltip.waypoint-label {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  pointer-events: auto;
}

.leaflet-tooltip.waypoint-label::before {
  display: none;
}

.waypoint-label-text {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .01em;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px #ffffff;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 0 6px rgba(255, 255, 255, 0.75);
}

.admin-task-target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: .6rem 0;
}

.admin-task-target-head button {
  width: auto;
}

#admin-add-task-target-row {
  background: #e7f6ee;
  border: 1px solid #bfe4cf;
  color: #1f6a45;
}

#admin-add-task-target-row:hover {
  background: #dcf1e7;
  border-color: #addabc;
}

.admin-task-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: .8rem;
}

.admin-task-save-row button {
  width: auto;
}

dialog {
  border: none;
  border-radius: 12px;
  width: min(600px, 90vw);
}

#guest-tasks-modal {
  width: min(1080px, 94vw);
  max-height: 86vh;
}

#guest-tasks-modal::backdrop {
  background: rgba(0, 28, 46, .45);
}

@media (max-width: 900px) {
  .layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
  }

  #map {
    width: 100%;
    flex: 1;
    min-height: 200px;
    border-radius: 8px;
  }

  .map-alert {
    top: .55rem;
    width: 60vw;
  }

  .route-info-box {
    bottom: 1.55rem;
  }

  .route-info-text {
    font-size: .88rem;
  }

  .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 200px !important;
  }

  .admin-gpx-form {
    grid-template-columns: 1fr;
  }

  .admin-waypoint-form {
    grid-template-columns: 1fr;
  }

  .admin-inline-form {
    grid-template-columns: 1fr;
  }

  .admin-rides-table thead {
    display: none;
  }

  .admin-rides-table,
  .admin-rides-table tbody,
  .admin-rides-table tr,
  .admin-rides-table td {
    display: block;
    width: 100%;
  }

  .admin-rides-table tr {
    border: 1px solid #dfecef;
    border-radius: 10px;
    padding: .45rem .5rem;
    margin-bottom: .5rem;
    background: #fff;
  }

  .admin-rides-table td {
    border-bottom: none;
    padding: .25rem 0;
  }

  .admin-rides-table td::before {
    content: attr(data-label);
    display: block;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #58757f;
    margin-bottom: .2rem;
    text-transform: uppercase;
  }

  .admin-rides-table td[data-label=""]::before {
    display: none;
    margin-bottom: 0;
  }

  .admin-rides-table .admin-actions {
    justify-content: flex-start;
  }

  .admin-target-row {
    grid-template-columns: 1fr 1fr;
    gap: .45rem;
  }

  .admin-target-row > :nth-child(1),
  .admin-target-row > :nth-child(2),
  .admin-target-row > :nth-child(5),
  .admin-target-row > :nth-child(6) {
    grid-column: 1 / -1;
  }

  .admin-target-row.is-swissgrid > [data-field="east4"],
  .admin-target-row.is-swissgrid > [data-field="north4"] {
    grid-column: auto;
  }

  .admin-task-save-row {
    justify-content: stretch;
  }

  .admin-task-save-row button {
    width: 100%;
  }

  .tasks .task-group-header {
    grid-template-columns: 48px 1fr auto;
  }

  .tasks .task-group-row {
    grid-template-columns: 48px 1fr 50px auto;
    padding: .5rem .6rem;
  }

  .tasks .target-point,
  .tasks .target-mma {
    font-size: .75rem;
  }
}

@media (min-width: 801px) {
  #sidebar-open-btn,
  #toggle-targets-btn,
  .tasks-backdrop {
    display: none !important;
  }

  #app-panel.targets-visible .tasks {
    transform: none;
  }
}

@media (max-width: 800px) {
  .footer-toggle-btn {
    right: .65rem;
    bottom: .65rem;
    width: 2.3rem;
    min-width: 2.3rem;
    padding: 0;
    justify-content: center;
    gap: 0;
  }

  .footer-toggle-btn span {
    display: none;
  }

  .footer-toggle-btn[aria-expanded="false"] {
    width: 2.3rem;
    min-width: 2.3rem;
    padding: 0;
  }

  .legal-modal-card {
    width: min(560px, 94vw);
    padding: .85rem;
  }

  .legal-section h2 {
    font-size: 1.2rem;
  }

  .legal-list li,
  .legal-section p {
    font-size: .96rem;
    line-height: 1.4;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  #sidebar-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffe9c5;
    border: 1px solid #efc280;
    color: #7a4700;
    font-size: 1.35rem;
    box-shadow: 0 8px 18px rgba(0, 24, 40, .22);
    animation: menu-button-wiggle .6s ease-in-out 7s infinite;
    transform-origin: 50% 65%;
  }

  #sidebar-open-btn:hover {
    background: #ffe0af;
    border-color: #e4b062;
  }

  .sponsor-splash-card {
    width: min(520px, 94vw);
  }

  .sponsor-splash-link {
    min-height: 64px;
  }

  .guidelines-splash-card {
    width: min(560px, 94vw);
    padding: .85rem;
  }

  .guidelines-splash-card h2 {
    font-size: 1.25rem;
    line-height: 1.2;
  }

  .guidelines-list {
    gap: .5rem;
  }

  .guidelines-list p {
    font-size: .98rem;
    line-height: 1.4;
    padding: .5rem .56rem;
  }

  .guidelines-splash-card small {
    font-size: .85rem;
    line-height: 1.35;
  }

  #guidelines-accept-btn {
    font-size: .95rem;
    padding: .62rem .7rem;
  }

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

  .tasks {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85vw;
    max-width: 85vw;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, .15);
    border-radius: 0;
    border: none;
  }

  #app-panel.targets-visible .tasks {
    transform: translateX(0);
  }

  .tasks-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(7, 28, 40, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
  }

  #app-panel.targets-visible .tasks-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .tasks-tab-panels {
    display: flex;
    width: 200%;
    transition: transform 0.25s ease;
  }

  .tasks-tab-panels[data-active-tab="app"] {
    transform: translateX(0);
  }

  .tasks-tab-panels[data-active-tab="admin"] {
    transform: translateX(-50%);
  }

  .tasks-tab-panel {
    width: 50%;
    flex-shrink: 0;
  }

  .admin-swiper {
    display: flex;
    width: 200%;
    transition: transform 0.25s ease;
  }

  .admin-swiper[data-admin-page="menu"] {
    transform: translateX(0);
  }

  .admin-swiper[data-admin-page="detail"] {
    transform: translateX(-50%);
  }

  .admin-swiper-page {
    width: 50%;
    flex-shrink: 0;
  }

  .tasks-app-control-row {
    grid-template-columns: 1fr;
  }

  #tasks-admin-panel-host {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
