:root {
    color-scheme: light dark;

    --fg: #111;
    --bg: #fff;
    --bg-surface: #fff;
    --bg-inset: #f1f3f5;
    --border: #111;
    --accent: 100, 180, 20;

    --font: "IBM Plex Sans", serif;
    --font-h: "IBM Plex Sans", serif;

    --main-width: 1280px;
    --radius: 0px;

    --chart-elevation: #e0e0e0;
    --chart-border: #ccc;
    --chart-label: #bbb;
    --chart-label-secondary: #999;
    --chart-pace: #7c5ac2;
    --chart-pace-30: #9b59b6;
    --chart-gap: #e67e22;
    --chart-hr: #e74c3c;
    --chart-elev: #95a5a6;
    --chart-power: #2ecc71;
    --chart-power-30: #27ae60;
    --chart-ctl: #3498db;
    --chart-form: #0ca678;

    --map-start: #22c55e;
    --map-end: #ef4444;
    --marker: #b197fc;

    --race-bg: #ffa8a8;
    --race-fg: #6b1a1a;
    --indoor-bg: #d0bfff;
    --indoor-fg: #3b1f7a;

    --message-info-bg: #d0ebff;
    --message-success-bg: #b2f2bb;
    --message-warning-bg: #ffec99;
    --message-error-bg: #ffe3e3;

    --delta-good: #2f9e44;
    --delta-bad: #e03131;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #f8f9fa;
        --bg: #111;
        --bg-surface: #1a1a1a;
        --bg-inset: #212529;
        --border: #f1f3f5;

        --chart-elevation: #495057;
        --chart-border: #495057;
        --chart-label: #868e96;
        --chart-label-secondary: #adb5bd;
        --chart-pace: #b197fc;
        --chart-pace-30: #cc5de8;
        --chart-gap: #ffa94d;
        --chart-hr: #ff6b6b;
        --chart-elev: #ced4da;
        --chart-power: #69db7c;
        --chart-power-30: #51cf66;
        --chart-ctl: #74c0fc;
        --chart-form: #38d9a9;

        --race-bg: #5c1f1f;
        --race-fg: #ffc9c9;
        --race-icon-bg: #e03131;
        --indoor-bg: #2f2159;
        --indoor-fg: #e5dbff;

        --message-info-bg: #15384f;
        --message-success-bg: #173b24;
        --message-warning-bg: #4a3b13;
        --message-error-bg: #4a1f1f;

        --delta-good: #69db7c;
        --delta-bad: #ff6b6b;
    }
}

html {
    box-sizing: border-box;
    font-size: 1.25rem;
}

body {
    margin: 0;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-left: 0.3rem;
    vertical-align: middle;
    position: relative;
    top: -0.15em;
}

.tag-race {
    background: var(--race-bg);
    color: var(--race-fg);
}

.tag-indoor {
    background: var(--indoor-bg);
    color: var(--indoor-fg);
}

.icon {
    position: relative;
    width: 20px;
    height: 20px;
    overflow: hidden;
    font-size: 0;
}

/* The icon SVGs stroke with currentColor, which is black when loaded via
   background-image — mask them instead so the glyph follows --fg. */
.icon.running::before,
.icon.cycling::before,
.icon.walking::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: var(--fg);
    -webkit-mask: no-repeat center / 16px 16px;
    mask: no-repeat center / 16px 16px;
}

.icon.running::before {
    -webkit-mask-image: url("/static/img/activity-icons/running.0ca96ec1091d.svg");
    mask-image: url("/static/img/activity-icons/running.0ca96ec1091d.svg");
}

.icon.cycling::before {
    -webkit-mask-image: url("/static/img/activity-icons/cycling.c6584cceb8a6.svg");
    mask-image: url("/static/img/activity-icons/cycling.c6584cceb8a6.svg");
}

.icon.walking::before {
    -webkit-mask-image: url("/static/img/activity-icons/walking.db3c2e192c57.svg");
    mask-image: url("/static/img/activity-icons/walking.db3c2e192c57.svg");
}

.icon.running.race {
    background-color: var(--race-icon-bg, var(--race-bg));
    border-radius: 50%;
}

.wrapper {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

.sidebar {
    width: 300px;
    background-color: var(--bg-inset);
    padding: 40px;
}

.main {
    flex: 1;
    min-width: 0;
}

.sidebar button.logo {
    font-size: 1.4em;
    padding-left: 1.4em;
    padding-right: 1.4em;
    background-color: #495057;
    color: #f8f9fa;
}

.sidebar nav ul {
    margin: 0;
}

.sidebar nav ul li {
    display: block;
    padding: 4px 0;
    margin: 0;
}

.sidebar nav ul li ul {
    margin-left: 1em;
}

.sidebar nav p {
    margin-bottom: 0;
}

.container {
    max-width: var(--main-width);
    width: 100%;
    padding: 40px;
}

.debug-dialog {
    width: min(32rem, calc(100% - 2rem));
    padding: 1rem;
    border: 0.1rem solid var(--border);
    background: var(--bg-surface);
    color: var(--fg);
}

.debug-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.debug-dialog h4 {
    margin-top: 0;
}

.debug-dialog textarea {
    font-family: monospace;
    resize: vertical;
}

.debug-dialog form {
    text-align: right;
}

.grid {
    display: flex;
}

#activities--list,
#nutrition--list,
#climbs--list {
    font-size: 0.8em;
    table-layout: fixed;
    width: 100%;
}

#activities--list td,
#nutrition--list td,
#climbs--list td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#activities--list th:nth-child(1),
#activities--list td:nth-child(1) {
    width: 32px;
}

#activities--list th:nth-child(2) {
    width: 20%;
}

#activities--list th:nth-child(3) {
    width: 18%;
}

/* Nutrition list: Date first (no icon column), Name takes the remainder. */
#nutrition--list th:nth-child(1) {
    width: 20%;
}

#nutrition--list th:nth-child(2) {
    width: 22%;
}

#activities--list .totals td {
    border-top: 1px solid var(--border);
}

#activities--list .date-short,
#nutrition--list .date-short,
#climbs--list .date-short {
    display: none;
}

.effort-pace {
    color: var(--chart-label-secondary);
    font-size: 0.85em;
    white-space: nowrap;
}

.weekly-summary {
    display: flex;
    flex-direction: column;
    gap: 2em;
    margin: 1.5em 0;
    padding: 1em 1.2em;
    background: var(--bg-inset);
}

.weekly-summary > h4 {
    margin: 0;
}

.weekly-summary--shape {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em 1.5em;
}

.weekly-summary--label {
    margin: 0 0 0.6em;
    font-weight: normal;
    font-size: 0.85em;
    color: var(--chart-label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.weekly-summary--metric {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    margin-bottom: 0.3em;
}

.weekly-summary--name {
    display: inline-block;
    min-width: 5em;
    font-weight: 600;
}

.weekly-summary--badge {
    display: inline-block;
    min-width: 3.5em;
    padding: 0.1em 0.5em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--chart-border);
}

.weekly-summary--badge.in-range {
    background: rgba(var(--accent), 0.18);
}

.weekly-summary--badge.spike {
    background: rgba(231, 76, 60, 0.18);
}

.weekly-summary--badge.below {
    background: var(--bg-inset);
}

.weekly-summary--detail {
    color: var(--chart-label-secondary);
    font-size: 0.9em;
}

.weekly-summary--efforts {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

.weekly-summary--efforts li {
    display: flex;
    gap: 0.6em;
    align-items: baseline;
}

.weekly-summary--efforts a {
    min-width: 5em;
    font-weight: 600;
}

.weekly-summary--races {
    display: flex;
    gap: 0.6em;
    align-items: baseline;
}

.weekly-summary--status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1em;
}

.weekly-summary--status-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}

.weekly-summary--status-grid strong {
    font-size: 1.25em;
    font-variant-numeric: tabular-nums;
}

.weekly-summary--status-value {
    text-transform: capitalize;
}

.weekly-summary--bar {
    display: flex;
    width: min(36em, 100%);
    height: 0.65em;
    margin: 0.6em 0 0.35em;
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

.weekly-summary--bar span {
    display: block;
    width: var(--pct);
}

.weekly-summary--bar .moderate {
    background: rgba(var(--accent), 0.35);
}

.weekly-summary--bar .heavy {
    background: rgba(230, 126, 34, 0.38);
}

.weekly-summary--bar .severe {
    background: rgba(231, 76, 60, 0.38);
}

.weekly-summary--badge.balanced,
.weekly-summary--badge.mostly-moderate {
    background: rgba(var(--accent), 0.18);
}

.weekly-summary--badge.mostly-severe {
    background: rgba(231, 76, 60, 0.18);
}

.weekly-summary--badge.mostly-heavy {
    background: rgba(230, 126, 34, 0.18);
}

.weekly-summary--cp {
    width: min(42em, 100%);
    border-collapse: collapse;
    font-size: 0.85em;
}

.weekly-summary--cp th,
.weekly-summary--cp td {
    padding: 0.3em 1.2em 0.3em 0;
    text-align: left;
    white-space: nowrap;
}

table.stats {
    width: auto;
    border-spacing: 1em 0;
    margin-left: -1em;
    margin-bottom: 2em;
}

table.stats td:first-child,
table.stats th:first-child {
    padding-left: 0.4rem;
}

table.stats td {
    width: 8em;
}

table.stats td.wide {
    width: 18em;
}

.stat-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: flex-start;
    margin-bottom: 2em;
}

.stat-item {
    flex: 0 0 auto;
    width: 8em;
    max-width: 100%;
}

.stat-item--wide {
    width: 18em;
}

.stat-label {
    position: relative;
    padding: 0.4rem;
    border-bottom: 0.1rem solid var(--fg);
    font-weight: 700;
}

.stat-value {
    padding: 0.4rem;
    border-bottom: 0.05rem solid var(--fg);
}

.stat-sub {
    padding: 0.2rem 0.4rem;
    font-size: 0.85em;
    opacity: 0.7;
}

.stat-delta {
    margin-left: 0.3em;
    font-size: 0.75em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stat-delta--good {
    color: var(--delta-good);
}

.stat-delta--bad {
    color: var(--delta-bad);
}

.split-data-table {
    margin-top: 1rem;
    overflow-x: auto;
}

.shoe-actions {
    display: flex;
    gap: 0.5rem;
}

.activity-section {
    margin-top: 2rem;
}

.split-stream-toggles {
    margin-top: 0.75rem;
    text-align: center;
}

.split-stream-toggles .btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
}

.split-data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    table-layout: auto;
}

.split-data-table th,
.split-data-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--chart-border);
    text-align: left;
    white-space: nowrap;
}

.split-data-table th {
    color: var(--chart-label-secondary);
    font-weight: 600;
}

.split-summary-row--expandable {
    cursor: pointer;
}

.split-summary-row--expandable:hover td {
    background: var(--bg-surface);
}

.split-summary-caret {
    display: inline-block;
    width: 0.45em;
    height: 0.45em;
    margin-right: 0.55em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    vertical-align: middle;
    opacity: 0.6;
}

.split-summary-row.is-open .split-summary-caret {
    transform: rotate(45deg);
}

.split-summary-caret--placeholder {
    visibility: hidden;
}

.split-summary-detail > td {
    padding: 0;
    background: var(--bg-surface);
    white-space: normal;
}

.split-summary-detail__content {
    padding: 0.2rem 0.9rem 0.9rem 1.5rem;
}

.expanding-table__content.split-detail-expanded {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.split-detail-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 1rem;
    margin: 0.8rem 0 1rem;
}

.split-detail-view--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split-detail-view--single {
    grid-template-columns: minmax(0, 1fr);
}

.split-detail-map {
    order: 1;
}

.split-detail-map__hover-marker {
    width: 18px;
    height: 18px;
    border: 2px solid;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.split-detail-chart {
    order: 2;
}

.split-detail-drift {
    order: 3;
    min-width: 0;
    overflow-x: auto;
}

.split-detail-map,
.split-detail-chart {
    width: 100%;
    min-width: 0;
    height: 220px;
    border: 1px solid var(--chart-border);
    background: var(--bg);
}

.split-detail-chart {
    position: relative;
    height: auto;
}

.split-detail-chart svg {
    display: block;
}

.split-detail-chart__tooltip {
    position: absolute;
    z-index: 2;
    width: max-content;
    padding: 4px 8px;
    border: 1px solid var(--chart-border);
    background: var(--bg-surface);
    font-size: 12px;
    pointer-events: none;
}

.split-summary-detail__content table.decoupling__halves th {
    color: var(--chart-label-secondary);
    font-weight: 600;
}

.split-summary-drift {
    margin: 0.9em 0 0;
}

.decoupling__subvalue {
    color: var(--chart-label-secondary);
    font-size: 0.8em;
    font-variant-numeric: tabular-nums;
}

.activity-meta .activity-notes {
    flex: 1 1 auto;
    width: auto;
}

.activity-meta .activity-notes .stat-value {
    white-space: pre-wrap;
}

.activity-edit-section {
    margin-bottom: 1.5em;
}

.activity-edit-section h4 {
    margin-bottom: 0.6em;
}

.activity-edit-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2em;
    align-items: start;
    border-top: 1px solid var(--chart-border);
    padding-top: 1em;
}

.target-zones {
    margin-top: 1.5em;
}

.target-zones > .helptext {
    display: block;
    margin-bottom: 0.8em;
}

.target-zones__labels,
.target-zone-row {
    display: grid;
    grid-template-columns: minmax(9em, 1fr) minmax(7em, 1fr) minmax(7em, 1fr) auto;
    gap: 0.5em;
    align-items: end;
}

.target-zones__labels {
    margin-bottom: 0.25em;
    color: var(--chart-label-secondary);
    font-size: 0.8em;
}

.target-zone-row {
    margin-bottom: 0.5em;
}

.target-zone-row label,
.target-zone-row input,
.target-zone-row select,
.target-zone-row button {
    width: 100%;
    margin: 0;
}

.target-zone-row__mobile-label {
    display: none;
}

.target-zone-remove {
    width: auto !important;
}

.target-zones__add {
    margin: 0.25em 0 0;
}

.target-zones__errors {
    margin: 0 0 0.8em;
    color: #c92a2a;
}

.configured-splits {
    margin-top: 1.5em;
}

.configured-splits > .helptext {
    display: block;
    margin-bottom: 0.8em;
}

.configured-splits__labels,
.configured-split-row {
    display: grid;
    grid-template-columns: minmax(7em, 0.7fr) minmax(9em, 1fr) minmax(9em, 1fr) auto;
    gap: 0.5em;
    align-items: end;
}

.configured-splits__labels {
    margin-bottom: 0.25em;
    color: var(--chart-label-secondary);
    font-size: 0.8em;
}

.configured-split-row {
    margin-bottom: 0.5em;
}

.configured-split-row label,
.configured-split-row input,
.configured-split-row button {
    width: 100%;
    margin: 0;
}

.configured-split-row__mobile-label {
    display: none;
}

.configured-split-remove {
    width: auto !important;
}

.configured-splits__actions {
    display: flex;
    gap: 0.5em;
    margin-top: 0.25em;
}

.configured-splits__actions button {
    margin: 0;
}

.configured-splits__errors {
    margin: 0 0 0.8em;
    color: #c92a2a;
}

.zone-tables {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1em 1.5em;
}

.activity-details .zone-tables {
    margin-bottom: 2em;
}

.expanding-tables {
    margin-bottom: 2em;
}

.expanding-table__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    cursor: pointer;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--fg);
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.expanding-table__toggle {
    margin-left: auto;
    width: 0.55em;
    height: 0.55em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-0.15em);
    transition: transform 0.15s ease;
}

.expanding-table__trigger[aria-expanded="true"] .expanding-table__toggle {
    transform: rotate(225deg) translate(-0.1em, -0.1em);
}

.expanding-table__content {
    width: min(32em, 100%);
    padding-top: 0.8em;
}

.decoupling__description {
    margin: 0 0 1em;
    color: var(--chart-label-secondary);
    font-size: 0.85em;
    line-height: 1.4;
}

.decoupling__summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em;
    padding-bottom: 0.8em;
    border-bottom: 1px solid var(--border);
}

.decoupling__summary div {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}

.decoupling__summary span {
    color: var(--chart-label-secondary);
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.decoupling__summary strong {
    font-size: 1.15em;
    font-variant-numeric: tabular-nums;
}

table.decoupling__halves {
    width: 100%;
    margin-top: 0.6em;
    border-collapse: collapse;
}

table.decoupling__halves th,
table.decoupling__halves td {
    padding: 0.35em 1.5em 0.35em 0;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

table.zone-table {
    width: auto;
    border-collapse: collapse;
    margin-left: 0;
    margin-bottom: 2em;
}

.weekly-summary table.zone-table {
    font-size: 0.8em;
}

table.zone-table td,
table.zone-table th {
    width: auto;
    padding: 0.3em 0.9em 0.3em 0;
    white-space: nowrap;
}

table.zone-table tr.zone-row {
    background: linear-gradient(
        to right,
        rgba(var(--accent), 0.22) var(--pct),
        transparent var(--pct)
    );
}

@media (max-width: 768px) {
    .weekly-summary--status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .activity-edit-actions {
        grid-template-columns: 1fr;
        gap: 1em;
    }

    .target-zones__labels {
        display: none;
    }

    .target-zone-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 0.8em;
        border-bottom: 1px solid var(--border);
    }

    .target-zone-row__mobile-label {
        display: block;
        margin-bottom: 0.2em;
        color: var(--chart-label-secondary);
        font-size: 0.75em;
    }

    .target-zone-remove {
        align-self: end;
    }

    .configured-splits__labels {
        display: none;
    }

    .configured-split-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 0.8em;
        border-bottom: 1px solid var(--border);
    }

    .configured-split-row__mobile-label {
        display: block;
        margin-bottom: 0.2em;
        color: var(--chart-label-secondary);
        font-size: 0.75em;
    }

    .configured-split-remove {
        align-self: end;
    }

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

    .zone-tables {
        grid-template-columns: 1fr;
    }

    table.zone-table {
        width: 100%;
    }
}

.btn-group {
    display: inline-flex;
    margin-bottom: 1rem;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
select {
    font-family: var(--font);
}

.btn-group button {
    margin: 0;
    border-radius: 0;
    border-right-width: 0;
}

.btn-group button:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.btn-group button:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
    border-right-width: 0.1rem;
}

.btn-danger {
    background: #e03131;
    color: #fff;
    border-color: #c92a2a;
}

.btn-group button.active {
    background: var(--fg);
    color: var(--bg);
}

svg text {
    font-family: var(--font);
}

.hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 6px;
    cursor: pointer;
    line-height: 0;
    align-items: center;
    justify-content: center;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

#efforts-chart svg text {
    font-size: 10px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.sidebar-backdrop.open {
    display: block;
}

@media (max-width: 768px) {
    html {
        font-size: 1rem;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.open {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        padding: 24px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .container {
        padding: 16px;
        padding-top: 48px;
        overflow-x: hidden;
    }

    table {
        width: 100%;
        font-size: 0.8em;
        table-layout: fixed;
    }

    .shoes-table {
        table-layout: auto;
    }

    .shoes-table td {
        word-break: break-word;
    }

    .shoe-actions {
        flex-direction: column;
    }

    table.stats {
        border-spacing: 0.5em 0;
        margin-left: -0.5em;
    }

    .activity-details table.stats {
        width: auto;
        table-layout: auto;
    }

    table.stats td {
        width: auto;
    }

    .split-data-table table {
        table-layout: auto;
    }

    .split-detail-view {
        grid-template-columns: minmax(0, 1fr);
    }

    .stat-group {
        gap: 1em 0.5em;
        font-size: 0.8em;
    }

    .stat-item {
        width: calc((100% - 1em) / 3);
    }

    .stat-item--wide {
        width: 100%;
    }

    .controls-row {
        flex-wrap: wrap;
    }

    .btn-group button {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
        font-size: 0.85em;
    }

    #activity-map {
        height: 45vh;
    }

    #activities--list th:nth-child(6),
    #activities--list td:nth-child(6),
    #activities--list th:nth-child(7),
    #activities--list td:nth-child(7),
    #activities--list th:nth-child(8),
    #activities--list td:nth-child(8),
    #activities--list th:nth-child(9),
    #activities--list td:nth-child(9),
    #activities--list th:nth-child(10),
    #activities--list td:nth-child(10) {
        display: none;
    }

    #activities--list th:nth-child(1),
    #activities--list td:nth-child(1) {
        width: 18px;
        padding-right: 0;
    }

    /* Short day/date, fixed narrow columns for the numbers; the name column
       (no width set) takes everything that's left. */
    #activities--list .date-full,
    #nutrition--list .date-full,
    #climbs--list .date-full {
        display: none;
    }

    #activities--list .date-short,
    #nutrition--list .date-short,
    #climbs--list .date-short {
        display: inline;
    }

    #activities--list th:nth-child(2) {
        width: 6em;
    }

    #activities--list th:nth-child(3) {
        width: auto;
    }

    #activities--list th:nth-child(4),
    #activities--list th:nth-child(5) {
        width: 6em;
    }

    /* Nutrition list: drop Distance, Pace, Sodium/hr, Caffeine/hr — keep
       Date, Name, Duration and Carbs/hr. */
    #nutrition--list th:nth-child(3),
    #nutrition--list td:nth-child(3),
    #nutrition--list th:nth-child(5),
    #nutrition--list td:nth-child(5),
    #nutrition--list th:nth-child(7),
    #nutrition--list td:nth-child(7),
    #nutrition--list th:nth-child(8),
    #nutrition--list td:nth-child(8) {
        display: none;
    }

    #nutrition--list th:nth-child(1) {
        width: 6em;
    }

    #nutrition--list th:nth-child(2) {
        width: auto;
    }

    /* Climbs list: keep Date, Activity, Distance and Elevation. */
    #climbs--list th:nth-child(5),
    #climbs--list td:nth-child(5),
    #climbs--list th:nth-child(6),
    #climbs--list td:nth-child(6),
    #climbs--list th:nth-child(7),
    #climbs--list td:nth-child(7) {
        display: none;
    }

    #climbs--list th:nth-child(1) {
        width: 6em;
    }

    #climbs--list th:nth-child(2) {
        width: auto;
    }

    #climbs--list th:nth-child(3),
    #climbs--list th:nth-child(4) {
        width: 6em;
    }

    .icon {
        width: 18px;
        height: 18px;
    }

    .icon.running::before,
    .icon.cycling::before,
    .icon.walking::before {
        -webkit-mask-size: 14px 14px;
        mask-size: 14px 14px;
    }

    .effort-pace {
        display: block;
    }

    .load-grid {
        font-size: 0.6em;
    }

    .load-grid td.day-cell,
    .load-grid td.week-total {
        padding: 0.7em 0.15em;
        min-width: 0;
    }

    .load-grid td.week-label {
        padding-right: 0.4em;
    }
}

.wind-arrow {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.18em;
}

.load-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75em;
    text-align: center;
}

.load-grid th {
    padding: 0.3em 0;
    font-weight: normal;
    color: var(--chart-label);
}

.load-grid td.day-cell,
.load-grid td.week-total {
    padding: 1.2em 0.5em;
    min-width: 2.5em;
}

.load-grid td.day-cell.future {
    opacity: 0.3;
}

.load-grid td.week-label {
    text-align: left;
    white-space: nowrap;
    padding-right: 0.8em;
    color: var(--chart-label-secondary);
    font-size: 0.9em;
}

.load-grid td.week-total {
    font-weight: 600;
}

.messages {
    list-style: none;
    max-width: var(--main-width);
    width: 100%;
    margin: 0 0 2em;
    padding: 40px 40px 0;
}

.messages + .container {
    padding-top: 0;
}

.messages li {
    padding: 1em;
    width: 100%;
    line-height: 2em;
}

.messages li.info,
.messages li.debug {
    background-color: var(--message-info-bg);
}

.messages li.success {
    background-color: var(--message-success-bg);
}

.messages li.warning {
    background-color: var(--message-warning-bg);
}

.messages li.error {
    background-color: var(--message-error-bg);
}

.task-status-overlay {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    max-width: min(360px, calc(100vw - 24px));
    padding: 0.45rem 0.65rem;
    background: var(--bg-inset);
    color: var(--fg);
    font-size: 0.65rem;
    line-height: 1.2;
    text-decoration: none;
}

.task-status-overlay strong {
    font-size: inherit;
    font-weight: 700;
}

.task-status-overlay small {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .messages {
        padding: 48px 16px 0;
    }

    .task-status-overlay small {
        display: none;
    }
}

/* Personal heatmap */
#personal-heatmap {
    width: 100%;
    height: 75vh;
}

@media (max-width: 768px) {
    /* Leave room at the bottom of the viewport to grab the page and
       scroll back up past the map. */
    #personal-heatmap {
        height: 65vh;
    }
}

.heatmap-empty {
    color: var(--chart-label-secondary);
    font-style: italic;
}

.heatmap-debug {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--fg);
}

.heatmap-debug summary {
    cursor: pointer;
    user-select: none;
}

.heatmap-debug dl {
    display: grid;
    grid-template-columns: max-content auto;
    gap: 0.15rem 1rem;
    margin: 0.5rem 0 0;
}

.heatmap-debug dt {
    font-weight: 500;
}

.heatmap-debug dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

/* Advanced search */
.search-form {
    margin-bottom: 2rem;
}

.search-form--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-field--label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--chart-label-secondary);
}

.search-field--label .unit {
    font-weight: 400;
}

.search-field--pair {
    display: flex;
    gap: 0.4rem;
}

.search-field--pair input {
    min-width: 0;
    width: 100%;
}

.search-field input,
.search-field select {
    margin: 0;
    width: 100%;
}

.search-form--sort {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.search-form--sort .search-field {
    min-width: 180px;
}

.search-form--actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.search-form--actions button {
    margin: 0;
}
