/* Shared Statistics subtitle, text rows and table spacing. Pages own columns/actions. */
:root {
 --statistics-row-padding:20px;
 --statistics-row-gap:var(--margin-grid-half);
 --statistics-rule-color:#dedede;
}
.statistics-page [hidden] { display:none; }
.statistics-page > .statistics-subtitle { margin-block:var(--margin-text) 0; padding-block:calc(-1 * var(--paragraph-top-compensator)) calc(-1 * var(--paragraph-bottom-compensator)); }
.statistics-page:has(> .statistics-subtitle:not([hidden])) > .statistics-table-scroll { margin-top:var(--margin-grid-half); }
/* Structural table wrappers must not add the site's section margin. */
.statistics-table-section { margin-top:0; }
.statistics-table-section > .statistics-table-scroll { margin-top:var(--margin-grid-half); }
/* Gutters belong to the native scroll content, so they leave the viewport with it. */
.statistics-table-frame { width:100vw; max-width:none; margin-inline:calc(-1 * var(--margin-grid)); }
.statistics-table-viewport { box-sizing:border-box; overflow-x:auto; overflow-y:hidden; padding-inline:var(--margin-grid); }
.statistics-table-frame > .statistics-table-viewport { width:100%; }
/* Overflowing tables end at the viewport edge; clipped final columns do so even when fitted. */
.statistics-table-viewport:is([data-horizontal-overflow],[data-table-flush-end]),
.statistics-table-frame:has(> .statistics-table-viewport:is([data-horizontal-overflow],[data-table-flush-end])) > :is(.swimming-sticky-head,.import-sticky-head) { padding-right:0; }
.statistics-table-frame > :is(.swimming-sticky-head,.import-sticky-head) { box-sizing:border-box; padding-inline:var(--margin-grid); }
.statistics-table { width:100%; color:var(--text-color); font-family:inherit; font-size:var(--paragraph-font-size); line-height:var(--paragraph-line-height); border-bottom:1px solid var(--statistics-rule-color); }
.statistics-table thead :is(th,td) { vertical-align:top; }
.statistics-table tbody { margin:0; }
.statistics-table tr { margin:0; border-top:1px solid var(--statistics-rule-color); }
.statistics-table td { margin:0; min-width:0; padding:var(--statistics-row-padding) var(--margin-grid-half); vertical-align:top; }
.statistics-table td:first-child { padding-left:var(--margin-grid); }
:where(.statistics-table-viewport) .statistics-table tr > :is(th,td):first-child { padding-left:0; }
.statistics-table td:last-child { padding-right:var(--margin-grid); }
:where(.statistics-table-viewport) .statistics-table tr > :is(th,td):last-child { padding-right:0; }
.statistics-table p.text { margin:0; max-width:none; line-height:var(--paragraph-line-height); padding-block:.25em; }
.statistics-row-text { display:flex; flex-direction:column; gap:var(--statistics-row-gap); min-width:0; }
.statistics-row-text > * { margin:0; }
.statistics-link-row { display:flex; align-items:baseline; gap:var(--margin-grid); }
.statistics-link-row > a { margin:0; }
/* One Activities/Log row layout, including independent original-file actions. */
.statistics-activity-table { --statistics-file-color:var(--text-color); display:grid; grid-template-columns:calc(36px + var(--margin-grid) * 1.5) minmax(0,1fr) calc(1em + var(--margin-grid) * 1.5); }
.statistics-activity-table td { padding-inline:calc(var(--margin-grid) / 2); }
.statistics-activity-table:has(.activity-edit-control) { grid-template-columns:calc(36px + var(--margin-grid) * 1.5) minmax(0,1fr) calc(2em + var(--margin-grid) * 2); }
.statistics-activity-table tbody tr[hidden] { display:none; }
.statistics-activity-table tbody { display:contents; }
.statistics-activity-table tbody tr { margin:0; display:grid; grid-template-columns:subgrid; grid-column:1 / -1; }
.statistics-activity-table .activity-name { white-space:normal; }
.activity-name p { max-width:none; white-space:normal; overflow-wrap:anywhere; }
.activity-circle { display:flex; align-items:center; justify-content:center; width:36px; height:36px; margin-top:calc((max(36px,var(--paragraph-line-height)) - 36px) / 2 + var(--paragraph-font-size) / 4); border-radius:50%; background:#bdbdbd; }
:is(.statistics-activity-table,.statistics-linked-table) tbody tr { cursor:pointer; }
@media (hover:hover) {
 :is(.statistics-activity-table,.statistics-linked-table) tbody tr:hover { background:var(--box-color); }
 :is(.statistics-activity-table,.statistics-linked-table) tbody tr:hover:not(:has(.activity-fit-link:hover)) { --text-color:var(--hover-color); color:var(--text-color); }
 .statistics-linked-table tbody tr:hover > :is(th,td) { background:var(--box-color); }
 .activity-fit-link:hover { color:var(--hover-color); }
}
.activity-circle svg { width:24px; height:24px; fill:currentColor; color:#fff; }
.activity-circle[data-icon="cycling"],.activity-circle[data-icon="indoor"] { background:var(--fog-green); }
.activity-circle[data-icon="strength"] { background:var(--fog-orange); }
.activity-circle[data-icon="mobility"] { background:var(--fog-purple); }
.activity-circle[data-icon="swimming"],.activity-circle[data-icon="open_water"] { background:var(--fog-blue); }
.activity-circle[data-icon="walking"] { background:color-mix(in srgb,var(--fog-green) 80%,white); }
.activity-circle[data-icon="multisport"] { background:var(--fog-red); }
.activity-circle[data-icon="other"] { background:var(--fog-red); }
.statistics-activity-table td:first-child { padding-top:8px; }
.activity-circle { margin-top:calc((max(36px,var(--paragraph-line-height)) - 36px) / 2 + var(--paragraph-font-size) / 4); }
.activity-file p.text { text-align:right; }
.activity-fit-link { color:inherit; text-decoration:none; }
.activity-fit-link svg { display:inline-block; width:calc(.7em * 12 / 18); height:calc(.7em * 23 / 18); vertical-align:baseline; }
.activity-fit-link[aria-disabled="true"] { cursor:default; }
.statistics-activity-table tbody tr { position:relative; }
.activity-source-link { color:inherit; text-decoration:none; }
.activity-file { --text-color:var(--statistics-file-color); color:var(--text-color); position:relative; z-index:1; display:flex; justify-content:flex-end; align-items:baseline; gap:var(--margin-grid-half); }
.activity-edit-control { appearance:none; margin:0; padding:0; border:0; border-radius:0; background:none; box-shadow:none; font:inherit; opacity:1; }
.activity-edit-control svg { width:1em; height:1em; }
@media (hover:hover) and (pointer:fine) { .activity-edit-control:hover { --text-color:var(--hover-color); } }
.activity-type-text { white-space:normal !important; overflow-wrap:anywhere; }
.activity-fit-choices { position:relative; text-align:right; }
.activity-fit-choices summary { list-style:none; cursor:pointer; }
.activity-fit-choices summary::-webkit-details-marker { display:none; }
.activity-fit-choices ul { position:absolute; right:0; z-index:2; margin:0; padding:10px; background:var(--box-color); list-style:none; }
.activity-file:has(.activity-fit-choices[open]) { z-index:2; }

.activity-fit-choices ul { width:max-content; }
.activity-fit-choices li { margin:0; }
.activity-fit-choices a { display:block; white-space:nowrap; }

/* Confirmed removal keeps the historical title and retained original action. */
.statistics-row-deleted .activity-source-link { text-decoration-line:line-through; text-decoration-thickness:1px; }
.statistics-load-sentinel { height:1px; margin:0; pointer-events:none; }

/* Shared clearance below tables for the fixed navigation controls. */
.statistics-page:is(.activities-page,.statistics-log-page,.swimming-page,.import-page,.context-page) { padding-bottom:calc(52px + max(22px,env(safe-area-inset-bottom) + 22px) * 2); }
@media(max-width:800px) { .statistics-page:is(.activities-page,.statistics-log-page,.swimming-page,.import-page,.context-page) { padding-bottom:calc(52px + max(13px,env(safe-area-inset-bottom) + 13px) * 2); } }
