:root {
  --app-font-family: Inter, "Segoe UI", Arial, sans-serif;
  --progress-label-size: 12px;
  --ink: #262238;
  --muted: #777187;
  --accent: #542570;
  --tint: #f3edf6;
  --line: #e5e0ee;
  --bg: #f8f7fc;
  --white: #fff;
  --control-font-size: 11px;
  --control-height: 32px;
  --control-line-height: 18px;
  --control-padding: 6px 12px;
  --shadow: 0 4px 20px #39245c0a;
  font-family: var(--app-font-family);
  color: var(--ink);
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
button,
input,
select {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--accent);
  color: white;
  height: var(--control-height);
  min-height: var(--control-height);
  line-height: var(--control-line-height);
  padding: var(--control-padding);
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 700;
}
button:hover,
.button:hover {
  background: #4d2166;
  color: white;
  border-color: #4d2166;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.primary:hover {
  background: #4d2166;
  color: white;
}
.subtle {
  background: var(--accent);
  color: white;
}
.full {
  width: 100%;
  margin-top: 10px;
}
input:not([type="checkbox"]),
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: var(--control-height);
  min-height: var(--control-height);
  line-height: var(--control-line-height);
  padding: var(--control-padding);
  background: white;
  color: var(--ink);
  min-width: 0;
}
input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid #9566ad;
  outline-offset: 2px;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
header {
  height: 84px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 30px;
  gap: 10px;
}
/* Header branding: transparent icon beside the wordmark. */
.brand {
  display: grid;
  grid-template-columns: 80px auto;
  grid-template-rows: 32px 16px;
  column-gap: 12px;
  row-gap: 6px;
  min-height: 80px;
  padding: 0;
  align-content: center;
  align-items: center;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.9px;
  color: var(--ink);
  text-decoration: none;
}

.brand-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.brand-wordmark {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.8px;
  line-height: 1;
}

.brand-light {
  grid-column: 2;
  grid-row: 2;
  display: block;
  margin-top: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pill {
  padding: 6px 10px;
  border-radius: 25px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.pill.connected {
  background: #e8f4ec;
  color: #28734a;
  border-color: #bdddc9;
}
.shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  max-width: 1800px;
  margin: auto;
}
aside {
  padding: 34px 24px;
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 10px);
  overflow: auto;
}
.section-label {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 1.7px;
  font-weight: 800;
}
h1 {
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: -1px;
  margin: 14px 0;
}
h2 {
  font-size: 26px;
  letter-spacing: -0.6px;
  margin: 7px 0;
}
h3 {
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.2px;
}
p {
  line-height: 1.6;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
  line-height: 1.55;
}
.sidebar-divider {
  height: 1px;
  background: var(--line);
  margin: 25px 0;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 17px;
}
label input,
label select {
  margin-top: 7px;
  font-weight: 700;
}
.date-range {
  display: grid;
  gap: 0;
}
#selectionText {
  margin-top: 10px;
  font-weight: 700;
}
.version {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 25px;
}
main {
  padding: 30px 30px 20px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.main-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 20px;
}
.notice {
  border: 1px solid #ddcfe5;
  background: #f6f0f8;
  padding: 13px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  color: #65527e;
}
.setup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border: 1px solid #ddcfe5;
  padding: 23px;
  border-radius: 14px;
  margin-bottom: 25px;
}
.setup p {
  max-width: 690px;
  margin-bottom: 0;
  color: #685a80;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}
.metrics article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 19px;
  box-shadow: var(--shadow);
}
.metrics span {
  color: var(--muted);
  font-size: 12px;
}
.metrics strong {
  display: block;
  font-size: 30px;
  letter-spacing: -0.8px;
  margin: 9px 0;
}
.metrics small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}
.metrics em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
.panel-head {
  padding: 19px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0;
}
.map-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.map-tools > select,
.map-tools > button {
  box-sizing: border-box;
  width: 180px;
  height: var(--control-height);
  min-height: var(--control-height);
  max-height: var(--control-height);
  margin: 0;
  flex: 0 0 180px;
  line-height: var(--control-line-height);
}
#map {
  height: 405px;
  background: #f0eef5;
  z-index: 1;
}
.map-footer {
  padding: 11px 22px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}
#weekly {
  height: 230px;
  padding: 0 13px 5px;
}
.highlight {
  margin: 0 22px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.highlight span {
  font-size: 12px;
  color: var(--muted);
}
.highlight strong {
  font-size: 25px;
  white-space: nowrap;
}
.highlight small {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
}

#maxVisits {
  text-align: right;
}

#maxVisits small {
  display: block;
}

#weekly,
#profile {
  touch-action: none;
}
.grid-explanation {
  margin: 15px 22px;
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
}
th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
  background: #faf8fe;
  padding: 12px 18px;
}
td {
  padding: 13px 18px;
  border-top: 1px solid #eeebf4;
  font-size: 12px;
  white-space: nowrap;
}
td:first-child,
th:first-child {
  width: 40px;
  padding-right: 0;
}
tr.tour-row {
  cursor: pointer;
}
tr.tour-row:hover {
  background: #f7f2f9;
}
tr.selected {
  background: #eadff0;
}
.tour-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  max-width: 370px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tour-date {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.pagination {
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
#profile {
  height: 340px;
  margin: 0 14px;
}
footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 3px 0 18px;
}
.leaflet-container {
  font-family: inherit;
}
.leaflet-popup-content {
  font-size: 12px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  background: var(--ink);
  color: white;
  border-radius: 10px;
  z-index: 9999;
  box-shadow: var(--shadow);
  max-width: 90vw;
}
[hidden] {
  display: none !important;
}
.empty-row {
  text-align: center;
  padding: 35px;
  color: var(--muted);
}
@media (min-width: 1450px) {
  #map {
    height: 470px;
  }
}
@media (max-width: 1100px) {
  header {
    padding: 2px 15px;
    height: auto;
    flex-wrap: wrap;
  }
  .shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  aside {
    padding: 25px 16px;
  }
  main {
    padding: 24px 18px;
  }
  .metrics {
    gap: 10px;
  }
  .metrics article {
    padding: 14px;
  }
  .metrics strong {
    font-size: 25px;
  }
  .map-panel .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .map-tools {
    justify-content: flex-start;
  }
  .lower-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  aside {
    position: static;
    height: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  aside h1,
  aside > p,
  aside > .section-label,
  aside > .sidebar-divider,
  aside > .version {
    display: none;
  }
  aside label {
    margin: 0;
  }
  #selectionText,
  #syncStatus {
    grid-column: 1/-1;
  }
  .full {
    margin: 0;
  }
  main {
    border-left: 0;
    padding: 16px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metrics strong {
    font-size: 28px;
  }
  .header-actions {
    width: 100%;
    gap: 6px;
    flex-wrap: wrap;
  }
  .header-actions .pill {
    display: inline-flex;
  }
  .header-actions #logout {
    margin-left: auto;
  }
  .main-title h2 {
    font-size: 22px;
  }
  .map-footer {
    flex-direction: column;
    gap: 5px;
  }
  #map {
    height: 350px;
  }
  .panel-head {
    padding: 17px;
  }
  .tour-name {
    max-width: 220px;
  }
  td,
  th {
    padding: 12px;
  }
  .detail-panel .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.leaflet-control a:focus-visible {
  outline: 2px solid #9566ad;
}
.brand:focus-visible {
  outline: 2px solid #9566ad;
  outline-offset: 5px;
  border-radius: 6px;
}

/* Weekly overview and persistent goals. */
.weekly-dashboard {
  margin-bottom: 30px;
  padding: 22px;
  background: var(--accent);
  border-radius: 12px;
  color: white;
}

.weekly-dashboard .section-label,
.weekly-dashboard .muted {
  color: #eadff0;
}

.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-heading p {
  margin: 5px 0 0;
  font-size: 12px;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.goal-card {
  padding: 19px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.goal-label {
  display: block;
  min-height: 18px;
  color: var(--accent);
  font-family: var(--app-font-family);
  font-size: var(--progress-label-size);
  font-weight: 700;
  line-height: 18px;
}

.goal-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  margin: 13px 0 16px;
}

.goal-value strong {
  font-size: 30px;
  letter-spacing: -0.8px;
}

.goal-value span {
  color: var(--muted);
  font-size: 14px;
}

.goal-card progress {
  display: block;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--tint);
  accent-color: var(--accent);
}

.goal-card progress::-webkit-progress-bar {
  background: var(--tint);
}

.goal-card progress::-webkit-progress-value {
  background: var(--accent);
}

.goal-card progress::-moz-progress-bar {
  background: var(--accent);
}

.goal-card.reached progress {
  accent-color: #348260;
}

.goal-card.reached progress::-webkit-progress-value {
  background: #348260;
}

.goal-card.reached progress::-moz-progress-bar {
  background: #348260;
}

.goal-card p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 11px;
}

#goalsDialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 18px 60px #26223830;
}

#goalsDialog::backdrop {
  background: #26223866;
}

#goalsForm > label {
  margin-bottom: 7px;
}

.goals-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin-top: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.form-error {
  color: #aa2c40;
}

@media (max-width: 1100px) {
  .goal-card {
    padding: 14px;
  }

  .goal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .weekly-dashboard {
    padding: 16px;
  }

  .dashboard-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .goal-card {
    padding: 14px;
  }

  .goal-value strong {
    font-size: 28px;
  }

  .goals-inputs {
    grid-template-columns: 1fr;
  }
}

/* Dedicated login screen. */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #eee1f4, var(--bg) 65%);
}

.login-card {
  width: min(440px, 100%);
  padding: 36px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 16px 50px #54257012;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-brand img {
  object-fit: contain;
}

.login-wordmark {
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1;
  margin-top: 6px;
}

.login-motto {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-top: 12px;
}

.login-intro {
  margin: 30px 0 24px;
  text-align: center;
}

.login-intro h1 {
  font-size: 25px;
  letter-spacing: -0.6px;
  margin: 0 0 8px;
}

.login-intro p {
  color: var(--muted);
  margin: 0;
}

#loginForm label {
  margin: 16px 0 7px;
}

#loginSubmit {
  width: 100%;
  margin-top: 22px;
}

.login-footer {
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  margin: 24px 0 0;
}

@media (max-width: 480px) {
  .login-page {
    padding: 16px;
  }

  .login-card {
    padding: 28px 22px;
  }
}

/* Keep reauthentication accessible when an open tab loses its session. */
.session-expired {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  width: min(600px, calc(100% - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: white;
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 8px 30px #39245c26;
}

@media (max-width: 700px) {
  .header-actions #login {
    margin-left: auto;
  }
}

/* Profile button and its two account actions. */
.profile-control {
  position: relative;
  margin-left: auto;
}

.profile-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}

.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--white);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1100;
  width: 190px;
  padding: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px #39245c20;
}

.profile-menu button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  padding: var(--control-padding);
}

.profile-menu #logout {
  color: white;
}

#profileDialog,
#profileSettingsDialog {
  width: min(460px, calc(100% - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
}

#profileDialog::backdrop,
#profileSettingsDialog::backdrop {
  background: #26223870;
}

#profileForm label {
  display: block;
  margin: 16px 0 7px;
}

.profile-photo-editor {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 20px 0;
}

.profile-photo-editor > div {
  min-width: 0;
}

.profile-photo-editor input {
  width: 100%;
  margin-bottom: 8px;
}

.profile-preview {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

/* Unified Flux controls; data cards and checkboxes keep their own appearance. */
select {
  font-weight: 700;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
select option,
select optgroup {
  background: white;
  color: var(--ink);
}
select:disabled {
  opacity: 0.65;
}
#tableCount {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
#activityCount {
  color: var(--accent);
}
.profile-menu button + button {
  margin-top: 5px;
}
.weekly-dashboard > .dashboard-heading button {
  border-color: #eadff0;
}
.goal-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
}
.goal-card-heading,
.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.goal-card-heading h3 {
  margin: 0;
}
.goal-card-heading button,
#resetActivityFilters {
  border-radius: 8px;
  align-self: end;
}
.goal-metric {
  display: block;
  width: 100%;
  height: auto;
  line-height: normal;
  margin-top: 12px;
  padding: 12px 10px;
  background: white;
  color: var(--ink);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  white-space: normal;
}
.goal-metric:hover {
  background: var(--tint);
  color: var(--ink);
  border-color: var(--line);
}
.goal-metric .goal-value {
  display: flex;
  margin: 9px 0 12px;
}
.goal-status {
  display: block;
  margin-top: 9px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.goal-metric.reached progress {
  accent-color: #348260;
}
.goal-metric.reached progress::-webkit-progress-value {
  background: #348260;
}
.goal-metric.reached progress::-moz-progress-bar {
  background: #348260;
}
.tour-summary {
  margin-top: 24px;
}
.summary-heading p {
  margin: 5px 0 0;
}
#summaryDialog {
  width: min(540px, calc(100% - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
}
#summaryDialog::backdrop {
  background: #26223870;
}
.summary-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.summary-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
@media (max-width: 700px) {
  .goal-grid {
    grid-template-columns: 1fr;
  }
  .summary-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .summary-options {
    grid-template-columns: 1fr;
  }
}

/* The current action keeps its purple fill and gains a black outline. */
button:not(.goal-metric):hover,
.button:hover,
button:not(.goal-metric):active,
.button:active,
button[aria-pressed="true"],
button[aria-expanded="true"] {
  background: var(--accent);
  color: white;
  border-color: #161219;
  box-shadow: 0 0 0 1px #161219;
}
button:focus-visible,
.button:focus-visible,
select:focus-visible {
  outline: 2px solid #161219;
  outline-offset: 2px;
}
select option:checked {
  background: var(--accent);
  color: white;
}

#weeklyRange {
  width: min(100%, 340px);
  text-overflow: ellipsis;
}
.lower-grid > .panel {
  min-width: 0;
}
.lower-grid > .panel:first-child .panel-head {
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  #profile {
    height: 300px;
  }
}

/* Compact weekly targets and activity summary groups. */
.archive-label,
.weekly-dashboard .section-label {
  font-size: 12px;
}
aside h1 {
  font-size: 26px;
}
.goal-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}
.goal-metric {
  min-width: 0;
  margin-top: 0;
}
.goal-metric .goal-value strong {
  font-size: 24px;
}
.summary-sport {
  margin-bottom: 22px;
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
}
.summary-sport .metrics {
  margin-bottom: 0;
  padding: 16px;
}
@media (max-width: 700px) {
  .summary-sport {
    margin-bottom: 16px;
  }
  .summary-sport .metrics {
    padding: 12px;
    gap: 10px;
  }
}
.summary-sport h4 {
  margin: 0;
  font-size: 14px;
  color: var(--accent);
}
.gear-list {
  grid-column: 1 / -1;
}
.gear-list ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.gear-list li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.gear-list li:last-child {
  border-bottom: 0;
}
.gear-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.gear-count,
.gear-last-used {
  color: var(--muted);
  font-size: 12px;
}
.gear-distance {
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.equipment-sort {
  flex-shrink: 0;
}
@media (max-width: 700px) {
  #equipmentSection > .panel-head {
    flex-wrap: wrap;
  }
}
.map-surface {
  position: relative;
}
.map-activation {
  height: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  z-index: 500;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #ffffff20;
  color: var(--accent);
  font-size: 14px;
  text-shadow: 0 1px 2px white;
  touch-action: pan-y;
}
button.map-activation:hover,
button.map-activation:active {
  background: #ffffff30;
  color: var(--accent);
  border: 0;
  box-shadow: none;
}
.map-interaction-hint {
  position: absolute;
  z-index: 500;
  right: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: white;
  color: var(--accent);
  font-size: 11px;
  pointer-events: none;
}
@media (max-width: 700px) {
  .goal-metrics {
    grid-template-columns: 1fr;
  }
}

aside label,
aside input:not([type="checkbox"]),
aside input::placeholder {
  font-weight: 700;
}
aside input::-webkit-datetime-edit {
  font-weight: 700;
}
#pageDialog {
  width: min(400px, calc(100% - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
}
#pageDialog::backdrop {
  background: #26223870;
}
#pageForm label {
  display: block;
  margin: 16px 0 7px;
}
/* Activity filters share one row; the counter stays at the right edge. */
.activity-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 22px 18px;
}
.activity-toolbar #tableCount {
  margin-left: auto;
  flex-shrink: 0;
  margin-bottom: 3px;
}
@media (max-width: 480px) {
  .activity-toolbar {
    gap: 10px;
    padding-right: 14px;
    padding-left: 14px;
  }
  .activity-toolbar .activity-search {
    width: 100%;
  }
}

.activity-search {
  display: block;
  margin: 0;
  width: 220px;
  max-width: 100%;
  font-weight: 700;
}

.activity-search input,
.activity-search input::placeholder {
  font-weight: 700;
}

/* One typography scale for controls and their labels, using the shared control size. */
button,
.button,
select,
label,
input:not([type="checkbox"]),
input::placeholder {
  font-family: inherit;
  font-size: var(--control-font-size);
  font-weight: 700;
}
.profile-button {
  font-size: 13px;
}
.goal-metric .goal-value strong {
  font-size: 24px;
}

.summary-heading,
.map-panel .panel-head {
  flex-direction: column;
  align-items: flex-start;
}
.map-tools {
  width: 100%;
  justify-content: flex-start;
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.summary-toggle {
  height: auto;
  line-height: normal;
  width: 100%;
  justify-content: space-between;
  border-radius: 0;
  border: 0;
  padding: 10px 14px;
  font-size: 14px;
  white-space: normal;
  text-align: left;
}
.summary-sport .metrics[hidden] {
  display: none;
}

/* Login actions use the inverted Flux palette. */
#loginSubmit,
a.button[href="/login"],
#loginSubmit:hover,
a.button[href="/login"]:hover,
#loginSubmit:active,
a.button[href="/login"]:active {
  background: var(--white);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.dashboard-greeting {
  margin: 0 0 20px;
}
.dashboard-greeting h2 {
  margin-bottom: 6px;
}
.dashboard-greeting p {
  margin: 0;
  color: var(--muted);
}
.weekly-tools {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px 16px;
}
.weekly-tools label {
  width: 180px;
  min-width: 0;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
}
.weekly-tools select {
  width: 100%;
  margin-top: 7px;
}
.weekly-tools button {
  margin: 0;
  flex: 0 0 auto;
}
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.equipment-list {
  padding: 0 22px 22px;
}
.equipment-list .equipment-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}
.equipment-items > li {
  min-width: 0;
}
@media (max-width: 700px) {
  .weekly-tools {
    padding: 0 14px 16px;
  }
  .equipment-list {
    padding: 0 14px 16px;
  }
  .equipment-list .equipment-items {
    grid-template-columns: minmax(0, 1fr);
  }
}
#gearDialog {
  width: min(480px, calc(100% - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
}
#gearDialog::backdrop {
  background: #26223870;
}
#gearProgress {
  overflow-wrap: anywhere;
}

.edit-filters,
.edit-actions {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 22px 20px;
}
.edit-filters label,
.edit-actions label {
  min-width: 150px;
  flex: 1;
  margin: 0;
}
.edit-filters .pill {
  margin-left: auto;
}
.edit-filters button,
.edit-actions button {
  min-height: var(--control-height);
}
@media (max-width: 700px) {
  .edit-filters,
  .edit-actions {
    padding: 0 14px 16px;
  }
}

#gearJobResults {
  max-height: 240px;
  overflow: auto;
  padding-left: 18px;
  overflow-wrap: anywhere;
}
#gearJobResults li {
  margin-bottom: 8px;
}

#archiveStart {
  margin: 7px 0 0;
  font-size: 12px;
}

/* Sidebar groups keep titles and their actions together on every viewport. */
.sidebar-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.sidebar-section > .section-label,
.sidebar-menu > .section-label {
  font-size: 12px;
  margin: 0 0 14px;
}
.sidebar-filter-fields,
.sidebar-selection-actions {
  display: grid;
  gap: 12px;
}
.sidebar-section label,
.sidebar-section .full,
.sidebar-menu .full {
  margin: 0;
}
.sidebar-menu {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 700px) {
  .sidebar-section,
  .sidebar-menu {
    margin-bottom: 0;
    padding-bottom: 16px;
    grid-column: 1 / -1;
  }
  .sidebar-filter-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }
  .sidebar-date-filter,
  #resetFilters {
    grid-column: 1 / -1;
  }
  .sidebar-date-filter .date-range {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .sidebar-selection-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tour-summary > .summary-heading {
  padding: 19px 22px;
  margin-bottom: 0;
}
.tour-summary > .summary-groups {
  padding: 0 22px 22px;
}
.summary-sport:last-child {
  margin-bottom: 0;
}
#profileButton,
#profileButton:hover,
#profileButton:active,
#profileButton[aria-expanded="true"] {
  background: var(--white);
  color: var(--accent);
  border: 1px solid var(--accent);
}
#mobileFilterDock > .sidebar-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 16px;
  margin: 0 0 22px;
  box-shadow: var(--shadow);
}
#mobileFilterDock .section-label {
  font-size: 14px;
}
#filterScopeHint {
  margin: 0 0 14px;
}
@media (max-width: 700px) {
  .tour-summary > .summary-heading {
    padding: 16px 14px;
  }
  .tour-summary > .summary-groups {
    padding: 0 14px 14px;
  }
}

.range-filter {
  min-width: 0;
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.range-filter legend {
  padding: 0 8px 0 0;
  font-size: var(--control-font-size);
  font-weight: 700;
}
.range-filter label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.range-filter output {
  font-weight: 400;
  text-align: right;
}
.range-filter input[type="range"] {
  height: 24px;
  min-height: 24px;
  padding: 0;
  margin: 2px 0 6px;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}
@media (max-width: 700px) {
  .sidebar-filter-fields .range-filter {
    grid-column: 1 / -1;
  }
}

.edit-inline-hint {
  margin: 0;
  padding: 0 22px 20px;
}
@media (max-width: 700px) {
  .edit-inline-hint {
    padding: 0 14px 16px;
  }
}

/* Text editing follows the same compact controls as gear assignment. */
.edit-actions [hidden] {
  display: none !important;
}
.edit-actions textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font: inherit;
}
.change-preview {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.change-preview li {
  margin-bottom: 8px;
}

.connection-settings {
  margin: 20px 0;
}
.connection-settings > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.connection-settings dt {
  font-weight: 700;
}
.connection-settings dd {
  margin: 0;
  text-align: right;
}
#selectEditPage {
  margin-bottom: 10px;
}

/* Keep the established mobile sport headers; reduce only desktop text. */
@media (min-width: 1101px) {
  .summary-sport h4,
  .summary-toggle {
    font-size: 13px;
  }
}

/* Shared column widths keep every map control aligned in portrait mode. */
@media (max-width: 700px) and (orientation: portrait) {
  .map-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .map-tools > select,
  .map-tools > button {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* Desktop places the last two map controls on a second row. */
@media (min-width: 1101px) {
  .map-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 180px));
  }
  .map-tools > select,
  .map-tools > button {
    width: 100%;
    min-width: 0;
  }
}
@media (max-width: 480px) {
  .map-tools,
  .summary-actions {
    gap: 10px;
  }
}

.equipment-actions {
  padding: 0 22px 22px;
}
.equipment-actions:has(button[hidden]) {
  display: none;
}
@media (max-width: 700px) {
  .equipment-actions {
    padding: 0 14px 16px;
  }
}

/* Consistent centered button content, including cards and profile menu actions. */
button,
.button,
.profile-menu button,
.summary-toggle,
.goal-metric {
  text-align: center;
  justify-content: center;
}
.summary-toggle {
  position: relative;
  padding-left: 34px;
  padding-right: 34px;
}
.summary-toggle > span:last-child {
  position: absolute;
  right: 14px;
}
.goal-metric .goal-value {
  justify-content: center;
}
.version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tint);
  color: var(--accent);
  font-weight: 700;
}
#equipmentHint {
  font-size: 12px;
}
#summaryHint {
  font-size: 14px;
}
.weekly-reference-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 22px 12px;
}
.weekly-reference-controls label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}
#mobileFilterDock #filterTitle {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
@media (max-width: 700px) and (orientation: portrait) {
  .shell {
    display: flex;
    flex-direction: column;
  }
  .shell > main {
    order: 1;
  }
  .shell > aside {
    order: 2;
  }
  aside > .version {
    display: inline-flex;
    justify-self: start;
  }
  .weekly-reference-controls {
    padding: 0 14px 12px;
  }
}

.weekly-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 6px 22px 18px;
}
.weekly-legend[hidden] {
  display: none;
}
/* Legend entries are chart labels, independent of action-button styles. */
#weeklyLegend .weekly-legend-item,
#weeklyLegend .weekly-legend-item:hover,
#weeklyLegend .weekly-legend-item:active,
#weeklyLegend .weekly-legend-item[aria-pressed] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: auto;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  overflow-wrap: anywhere;
}
#weeklyLegend .weekly-legend-item.is-hidden {
  opacity: 0.5;
  text-decoration: line-through;
}
.legend-symbol {
  width: 32px;
  height: 16px;
  flex: 0 0 32px;
  background: transparent;
}
@media (max-width: 700px) {
  .weekly-legend {
    padding: 6px 14px 16px;
  }
}

.activity-details > .detail-subsection {
  border-top: 1px solid var(--line);
  margin: 0;
}
.activity-details > .tour-summary > .summary-heading {
  padding: 19px 22px;
  margin-bottom: 0;
}
.activity-details > .tour-summary > .summary-groups {
  padding: 0 22px 22px;
}
.summary-equipment {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 4px 0;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#activityMap {
  height: 340px;
  margin: 0 22px 22px;
  border-radius: 10px;
  z-index: 1;
}
#activityMap[hidden] {
  display: none;
}
.analysis-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 0 22px 18px;
}
.analysis-controls fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}
.analysis-controls fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.analysis-controls > label {
  margin: 0;
}
.analysis-plot {
  padding: 0 22px 18px;
}
.analysis-plot h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.analysis-chart {
  height: 280px;
  touch-action: none;
}
@media (max-width: 700px) {
  .activity-details > .tour-summary > .summary-heading {
    padding: 16px 14px;
  }
  .activity-details > .tour-summary > .summary-groups {
    padding: 0 14px 14px;
  }
  #activityMap {
    height: 300px;
    margin: 0 14px 16px;
  }
  .analysis-controls,
  .analysis-plot {
    padding-left: 14px;
    padding-right: 14px;
  }
}

#profile[hidden] {
  display: none;
}

/* Three columns require enough card width for readable one-line forecasts. */
@media (min-width: 1101px) {
  @container weekly-goal (min-width: 460px) {
    .goal-metrics:has(> .goal-metric:nth-child(3)):not(
        :has(> .goal-metric:nth-child(4))
      ) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
  .goal-metrics:has(> .goal-metric:nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#analysisParameters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.analysis-parameter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.analysis-parameter-row label {
  flex: 1;
  margin: 0;
}
.analysis-parameter-row button {
  width: 32px;
  padding: 0;
}

.analysis-help {
  margin: 0 22px 14px;
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 700px) {
  .analysis-help {
    margin-right: 22px;
    margin-left: 22px;
  }
}
#summaryHint[hidden] {
  display: none;
}

.network-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 22px;
  align-items: start;
}
.network-grid > .panel {
  min-width: 0;
}
@media (max-width: 1100px) {
  .network-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.map-tools button,
.map-tools select {
  text-align: left;
  text-align-last: left;
  justify-content: flex-start;
}

body.map-fullscreen-open {
  overflow: hidden;
}
.map-surface.is-fullscreen,
.map-surface:fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 10000;
  background: white;
}
.map-surface.is-fullscreen #map,
.map-surface:fullscreen #map {
  height: 100%;
  width: 100%;
}
.map-fullscreen-exit {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 1100;
}
.map-fullscreen-exit[hidden],
.map-surface.is-fullscreen .map-interaction-hint {
  display: none;
}

th .column-sort,
th .column-sort:hover,
th .column-sort:active {
  height: auto;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  font-size: inherit;
  font-weight: 700;
  justify-content: flex-start;
}
.sort-direction {
  color: var(--accent);
}

@media (max-width: 700px) and (orientation: portrait) {
  .shell > #appFooter {
    order: 3;
    padding: 16px 20px 24px;
  }
}

.goal-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.goal-card-actions button {
  align-self: center;
}
.goal-forecast {
  /* Use the full metric cell; bars retain their approved inner alignment. */
  margin-inline: calc(-1 * var(--goal-metric-inline-padding));
  display: block;
  grid-row: 3;
  white-space: nowrap;
  line-height: 14px;
  min-height: 14px;
  margin-block: 4px 8px;
  color: var(--muted);
  font-size: 11px;
}
@media (min-width: 1101px) {
  .goal-grid {
    align-items: stretch;
  }
  .goal-card .goal-metrics {
    align-items: stretch;
  }
}

.goal-card-heading {
  flex-wrap: wrap;
}
.goal-card-heading h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Weekly goals: bright violet-to-gold segments across the filled portion. */
.goal-card {
  container-name: weekly-goal;
  container-type: inline-size;
  --goal-progress-caption-gap: 9px;
  --goal-value-weight: 900;
  --goal-metric-inline-padding: 10px;
}
/* Fixed semantic rows keep forecasts and bars aligned, even without estimates. */
.goal-card .goal-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 18px max-content 26px 18px auto;
  align-content: start;
  align-items: start;
  gap: 0;
  padding-inline: var(--goal-metric-inline-padding);
}
.goal-card .goal-metric .goal-label {
  grid-row: 1;
}
.goal-card .goal-metric .goal-value {
  grid-row: 2;
  margin: 13px 0 0;
  line-height: 1.25;
}
.goal-card .goal-metric .segment-progress {
  grid-row: 4;
}
.goal-card .goal-metric .goal-status {
  grid-row: 5;
}
.goal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sport-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sport-icon {
  width: 23px;
  height: 25px;
  flex: 0 0 auto;
  color: #602a80;
}
.summary-toggle .sport-icon {
  color: #fff;
}
.sport-heading > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.activity-sport-icon {
  display: inline-flex;
  flex: 0 0 auto;
}
.tour-name .sport-icon {
  width: 19px;
  height: 21px;
}
.segment-progress {
  display: block;
  width: 100%;
  min-width: 0;
  height: 22px;
  border-radius: 999px;
  box-shadow: 0 0 5px #602a802e;
}
.segment-progress svg {
  display: block;
  width: 100%;
  height: 100%;
}
.goal-card .goal-card-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}
.goal-card-heading .goal-card-actions {
  grid-column: 2;
  grid-row: 1;
}
.goal-card-heading .goal-card-actions,
.goal-card-heading .goal-card-actions button {
  align-self: start;
}
.goal-card-heading h3 {
  font-size: 16px;
  max-width: 180px;
  align-self: center;
}
.goal-card-heading h3.sport-heading > span:last-child {
  overflow-wrap: normal;
  word-break: normal;
}
.goal-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  width: 100%;
  gap: var(--goal-progress-caption-gap);
  grid-column: 1 / -1;
  grid-row: 2;
}
.goal-total-value {
  color: var(--ink);
  font-size: var(--goal-counter-size, 24px);
  font-weight: var(--goal-value-weight);
  letter-spacing: -0.8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.goal-card-actions button {
  padding: 7px 9px;
  font-size: 12px;
}
.goal-metric .segment-progress {
  height: 18px;
}
.goal-status {
  font-weight: 700;
  margin-top: var(--goal-progress-caption-gap);
}
.goal-metric .goal-value strong {
  font-weight: var(--goal-value-weight);
}
@media (min-width: 1251px) {
  .goal-total {
    margin-inline: var(--goal-metric-inline-padding);
    width: calc(
      100% - var(--goal-metric-inline-padding) -
        var(--goal-metric-inline-padding)
    );
  }
}
@media (max-width: 1250px) {
  .goal-grid {
    grid-template-columns: 1fr;
  }
  .goal-card .goal-card-heading {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .goal-total {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    gap: var(--goal-progress-caption-gap);
  }
  .goal-card-actions {
    grid-column: 2;
    grid-row: 1;
  }
}
@media (max-width: 900px) {
  :root {
    --progress-label-size: 14px;
  }
}
@media (max-width: 480px) {
  .goal-card .goal-card-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .goal-total {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    gap: var(--goal-progress-caption-gap);
  }
  .goal-card-actions {
    grid-column: 2;
    grid-row: 1;
  }
  .goal-total-value {
    flex-shrink: 0;
  }
  .goal-card-heading h3 {
    font-size: 13px;
    gap: 4px;
  }
  .goal-card-heading .sport-icon {
    width: 18px;
    height: 21px;
  }
  .goal-card-actions button {
    padding: 6px;
    font-size: 11px;
  }
}

/* One shared scale keeps all weekly counters consistent at every viewport width. */
.goal-metric .goal-value {
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
  width: 100%;
  gap: calc(var(--goal-counter-size, 24px) * 0.25);
}
.goal-metric .goal-value strong {
  font-size: var(--goal-counter-size, 24px);
  flex-shrink: 0;
}
.goal-metric .goal-value span {
  font-size: calc(var(--goal-counter-size, 24px) * 0.58);
  flex-shrink: 0;
}

@media (max-width: 700px) and (orientation: portrait) {
  .edit-page .shell > aside {
    align-self: stretch;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .edit-page aside .sidebar-selection-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .edit-page aside .sidebar-section,
  .edit-page aside .sidebar-selection-actions,
  .edit-page aside .sidebar-menu {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }
  .edit-page aside .sidebar-selection-actions > button,
  .edit-page aside .sidebar-menu > .button {
    display: flex;
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: var(--control-height);
    margin: 0;
  }
}

/* Dashboard and analytics share components, while retaining separate filter state. */
.app-navigation {
  display: grid;
  gap: 12px;
}
.app-navigation [aria-current="page"] {
  border-color: #15121a;
  box-shadow: inset 0 0 0 1px #15121a;
}
.month-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  padding: 0 22px 22px;
}
/* Momentum: approved purple/gold design, using live independent sport streaks. */
.streak-banner {
  --streak-gold: #f0cf7d;
  position: relative;
  padding: 28px;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(115deg, #3a194e, #602a80 65%, #734094);
}
.streak-banner::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: #ffffff0a;
  right: -45px;
  top: -100px;
  pointer-events: none;
}
.streak-banner-heading,
#streakCards,
.streak-origin {
  position: relative;
  z-index: 1;
}
.streak-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #f1e6f7;
}
#streakTitle {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.6px;
  color: var(--streak-gold);
}
.streak-hero-number {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 21px 0;
  min-width: 0;
}
.streak-number {
  font-size: clamp(56px, 7vw, 82px);
  font-weight: 750;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--streak-gold);
  flex-shrink: 0;
}
.streak-hero-context {
  min-width: 0;
}
.streak-hero-context p {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.35;
}
.streak-hero-context span,
.streak-start {
  font-size: 13px;
  line-height: 1.5;
  color: #e5d6ee;
}
.streak-flame {
  flex-shrink: 0;
}
.streak-sports {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.streak-sport {
  display: flex;
  flex-wrap: wrap;
  row-gap: 6px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: #ffffff1c;
}
.streak-sport > span {
  font-size: 13px;
  color: #f1e6f7;
  overflow-wrap: normal;
}
.streak-sport strong {
  font-size: 16px;
  color: var(--streak-gold);
  white-space: nowrap;
}
.streak-origin {
  margin: 16px 0 0;
  color: #e5d6ee;
  font-size: 11px;
}
@media (max-width: 700px) {
  .streak-banner {
    padding: 24px;
  }
  .streak-sports {
    grid-template-columns: minmax(0, 1fr);
  }
  .streak-hero-number {
    flex-wrap: wrap;
    gap: 14px;
  }
  .streak-hero-context {
    flex: 1;
    min-width: 135px;
  }
  .streak-flame {
    width: 30px;
    height: 35px;
  }
}
@media (max-width: 380px) {
  .streak-hero-number {
    gap: 10px;
  }
  .streak-hero-context {
    min-width: 0;
  }
  .streak-hero-context p {
    font-size: 16px;
  }
  .streak-hero-context span {
    font-size: 12px;
  }
}
.month-sport {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}
.month-sport h3 {
  margin: 0 0 16px;
}
.month-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.month-stats div {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.month-stats strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.month-stats span {
  color: var(--muted);
  font-size: 12px;
}
#analysisFilters .analysis-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0 22px;
}
#analysisFilters .analysis-controls label {
  margin: 0;
}
.analysis-months {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px 16px;
}
.analysis-months input {
  margin-top: 7px;
}
.analysis-months input[aria-invalid="true"] {
  border-color: #a12130;
}
.analysis-field-error {
  margin: 5px 0 0;
  color: #a12130;
  font-size: 12px;
}
.analysis-compare {
  grid-column: 1 / -1;
}
.analysis-period-hint {
  padding: 0 22px 16px;
  font-size: 12px;
}
[data-page="analytics"] .weekly-tools {
  flex-wrap: wrap;
  justify-content: flex-start;
}
[data-page="analytics"] .weekly-tools label {
  flex: 0 1 210px;
}
[data-page="analytics"] .weekly-tools button {
  margin-left: auto;
}
.analysis-week-hint {
  margin: 0 22px 12px;
  font-size: 12px;
}
@media (max-width: 700px) {
  #analysisFilters .analysis-controls {
    grid-template-columns: 1fr;
  }
  [data-page="analytics"] .weekly-tools {
    align-items: stretch;
  }
  [data-page="analytics"] .weekly-tools label {
    flex: 1 1 165px;
  }
  [data-page="analytics"] .weekly-tools button {
    margin-left: 0;
  }
  .analysis-week-hint {
    margin-right: 14px;
    margin-left: 14px;
  }
  #monthReview .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  #monthReviewLink {
    width: 100%;
    box-sizing: border-box;
  }
}
@media (max-width: 700px) and (orientation: portrait) {
  .shell > aside {
    align-self: stretch;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }
}

[data-page="analytics"] #resetWeeklyZoom {
  margin-left: auto;
}

.edit-page aside .sidebar-menu {
  display: grid;
  gap: 12px;
}

.month-stats strong {
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: var(--month-counter-size, 18px);
}
[data-page="analytics"] #filterScopeHint {
  color: var(--muted);
}

/* WDS-FOOTER-001: copyright left and install action centered on the same row. */
.app-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px 16px;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 18px 22px;
  color: var(--muted);
  font-size: 11px;
}
.footer-copyright {
  grid-column: 1;
  grid-row: 1;
  text-align: left;
 
}

.app-footer .flux-pwa-install {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
 
}
.sidebar-version {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
 
}
.shell > aside {
  display: flex;
  flex-direction: column;
 
}
.shell > aside > .sidebar-version {
  margin-top: auto;
  padding-top: 24px;
 
}
.login-version {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
 
}
.release-version {
  flex-shrink: 0;
  margin: 0 0 0 auto;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: 0;
}
.login-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}
.login-page > .app-footer {
  max-width: 460px;
  margin: 16px auto 0;
}
@media (max-width: 700px) {
  .app-footer {
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .release-version {
    font-size: 12px;
  }
}

/* Activity analysis: selectable parameter tiles, separate axis controls and chart cards. */
.custom-analysis-panel .analysis-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: start;
  gap: 20px;
}
.custom-analysis-panel #analysisParameters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 0;
  padding: 0;
  min-width: 0;
}
#analysisParameters legend {
  color: var(--muted);
  margin-bottom: 12px;
  padding: 0;
}
.custom-analysis-panel .analysis-parameter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 32px;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}
.custom-analysis-panel .analysis-parameter-row:has(input:checked) {
  border-color: var(--accent);
  background: var(--tint);
}
.custom-analysis-panel .analysis-parameter-row label {
  min-width: 0;
  min-height: 36px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.custom-analysis-panel .analysis-parameter-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: var(--accent);
}
.custom-analysis-panel .analysis-parameter-row button {
  min-height: 36px;
  width: 32px;
  align-self: center;
  border-radius: 7px;
}
.analysis-axis-controls {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.analysis-axis-controls label {
  margin: 0;
  color: var(--muted);
  font-weight: 400;
}
.analysis-axis-controls select {
  min-height: 44px;
  background: var(--white);
  border-color: var(--line);
  color: var(--accent);
  font-weight: 400;
}
.analysis-axis-controls button {
  min-height: 44px;
}
#customCharts {
  display: grid;
  gap: 16px;
  padding: 0 22px 22px;
}
#customCharts:empty {
  padding-bottom: 0;
}
#customCharts .analysis-plot {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}
#customCharts .analysis-plot h4 {
  font-size: 16px;
  margin: 0 0 12px;
}
.analysis-chart {
  width: 100%;
  min-width: 0;
}
@media (max-width: 1200px) {
  .custom-analysis-panel .analysis-controls {
    grid-template-columns: minmax(0, 1fr);
  }
  .analysis-axis-controls {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}
@media (max-width: 700px) {
  .custom-analysis-panel #analysisParameters {
    grid-template-columns: minmax(0, 1fr);
  }
  .analysis-axis-controls {
    grid-template-columns: minmax(0, 1fr);
  }
  #customCharts {
    padding: 0 14px 16px;
  }
  #customCharts .analysis-plot {
    padding: 12px;
  }
}

/* Sport selection and its single shared, paginated activity list. */
#summaryCards:has(.summary-sport-grid) {
  display: block;
}
.summary-sport-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.summary-sport-tile {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 112px;
  padding: 16px 8px;
  white-space: normal;
  background: var(--white);
  color: var(--accent);
}
.summary-sport-tile[aria-pressed="true"] {
  background: var(--accent);
  color: var(--white);
}
.summary-sport-tile[aria-pressed="true"] .sport-icon {
  color: inherit;
}
.summary-sport-tile strong {
  font-size: 24px;
}
.summary-activity-list {
  margin-top: 24px;
}
.summary-activity-rows {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.summary-activity-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  height: auto;
  min-height: 52px;
  width: 100%;
  padding: 12px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  white-space: normal;
}
.summary-activity-row .sport-heading {
  flex: 1;
}
.summary-activity-row strong {
  overflow-wrap: anywhere;
}
.summary-activity-row > span:last-child {
  color: var(--muted);
  font-size: 12px;
}
.summary-list-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.summary-list-pagination[hidden] {
  display: none;
}
.activity-measurement-heading {
  padding: 22px;
  border-top: 1px solid var(--line);
}
@media (min-width: 901px) and (max-width: 1200px) {
  .summary-sport-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .summary-sport-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .summary-activity-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .shell > aside > .sidebar-version {
    display: none;
  }
}
@media (max-width: 600px) {
  .app-footer {
    grid-template-columns: auto minmax(0, 1fr);
    padding-inline: 12px;
  }
  .footer-copyright {
    grid-column: 1;
    grid-row: 1;
  }
  .app-footer .flux-pwa-install {
    grid-column: 2;
    grid-row: 1;
  }
  .login-version {
    grid-column: 2;
    grid-row: 2;
  }
}
.summary-sport-grid .summary-sport-tile:hover,
.summary-sport-grid .summary-sport-tile:active {
  background: var(--tint);
  color: var(--accent);
}
.summary-sport-grid .summary-sport-tile[aria-pressed="true"] {
  background: var(--accent);
  color: var(--white);
}
.summary-sport-grid .sport-icon {
  color: inherit;
}
.summary-activity-rows .summary-activity-row:hover,
.summary-activity-rows .summary-activity-row:active,
.summary-activity-rows .summary-activity-row[aria-pressed="true"] {
  background: var(--tint);
  color: var(--ink);
}

/* One section heading scale across all profile integrations. */
#profileSettingsDialog .settings-section-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--app-font-family);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}
.settings-integration-icon {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
}
