/* Workout home and shared header controls. */
@font-face {
    font-family: "Barlow Condensed";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/BarlowCondensed-SemiBold.ttf") format("truetype");
}

.kiosk-view, .start-panel, .activity-section, .home-workouts { min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-family: "Barlow Condensed", ui-sans-serif, system-ui, sans-serif; font-size: 1rem; font-weight: 600; letter-spacing: .08em; }
.brand-band { display: block; flex: 0 0 auto; width: 49px; height: 40px; object-fit: cover; }
.account-menu { position: relative; min-width: 0; max-width: 100%; margin-left: auto; }
.title-button { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; }
.title-button span { font-size: .75rem; line-height: 1.5; font-weight: 430; }
.title-button .account-avatar { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--line); color: var(--ink); font-size: .75rem; font-weight: 500; }
#account-title { min-width: 0; text-overflow: ellipsis; white-space: nowrap; }
.title-button .picker-chevron { display: block; width: 16px; height: 16px; flex: 0 0 16px; color: inherit; }
.account-menu-panel { position: absolute; top: calc(100% + 12px); right: 0; z-index: 20; width: min(350px, calc(100vw - 32px)); max-height: calc(100dvh - 110px); overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.account-menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; text-align: left; color: var(--ink); background: transparent; border: 0; border-radius: var(--button-radius); }
.account-menu-panel button:hover { background: var(--soft); }
.account-menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px; }
.theme-picker-button img { margin-left: auto; object-fit: cover; flex: 0 0 auto; }
.theme-picker-button #theme-name { color: var(--muted); font-size: .8rem; }
.theme-chevron { flex: 0 0 auto; transition: transform .15s; }
.theme-picker-button[aria-expanded="true"] .theme-chevron { transform: rotate(180deg); }
.theme-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 8px; }
.theme-options[hidden] { display: none; }
.account-menu-panel .theme-option { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 66px; padding: 5px 2px; border: 1px solid transparent; font-size: .7rem; font-weight: 500; text-align: center; }
.theme-option img { width: 46px; height: 36px; max-width: 100%; object-fit: cover; }
.account-menu-panel .theme-option[aria-pressed="true"] { border-color: var(--accent); }
.start-panel { gap: 0; overflow-anchor: none; }
.activity-slot { min-width: 0; }
.activity-section { padding-bottom: 10px; }
.home-section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.heading-actions { display: flex; align-items: center; gap: 16px; }
.start-panel h2, .activity-section h2 { font-size: 1.25rem; font-weight: 550; line-height: 1.4; letter-spacing: 0; text-transform: none; }
.text-action { border: 0; padding: 6px 0; background: transparent; color: var(--muted); font-size: .85rem; }
.text-action:hover { color: var(--ink); text-decoration: underline; }
.activity-range { margin-left: auto; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.activity-calendar-layout { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 8px; }
.activity-weekdays { display: grid; grid-template-rows: repeat(7, var(--activity-dot-size, 10px)); gap: 4px; padding-top: 22px; color: var(--muted); font-size: 10px; line-height: 1; text-align: center; }
.activity-weekdays span { display: grid; place-items: center; }
.activity-calendar { overflow-x: auto; padding: 26px 4px 4px; margin: -26px -4px -4px; }
.calendar-content { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 22px auto; min-width: 720px; }
.calendar-months { grid-column: 1; display: grid; grid-template-columns: repeat(var(--activity-weeks, 53), minmax(0, 1fr)); gap: 4px; color: var(--muted); font-size: .75rem; }
.calendar-months button { grid-row: 1; white-space: nowrap; justify-self: start; align-self: start; padding: 0 0 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font: inherit; }
.calendar-months button:hover { color: var(--ink); }
.calendar-months button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.calendar-months .calendar-year { color: var(--ink); font-weight: 700; transform: translateY(-22px); }
.activity-grid { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(7, 1fr); grid-template-columns: repeat(var(--activity-weeks, 53), minmax(0, 1fr)); grid-auto-flow: column; gap: 4px; }
.activity-dot { width: 100%; padding: 0; border: 0; border-radius: 50%; aspect-ratio: 1; background: transparent; }
.activity-dot[data-count="0"]:not(.future-day) { background: var(--activity-zero); }
.activity-dot[data-count="2"], .activity-legend .workout-swatch { background: var(--activity-mid); }
.activity-dot.pr-day, .activity-legend .pr-swatch { background: var(--activity-pr); }
.activity-dot.outside-period { opacity: .25; }
.activity-legend .pr-swatch { margin-left: 8px; }
.activity-dot:hover { outline: 2px solid var(--muted); outline-offset: 1px; }
.activity-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; }
.activity-footer:has(#expand-activity[hidden]) { grid-template-columns: minmax(0, 1fr); }
.year-stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: .875rem; font-weight: 430; line-height: 1.5; font-variant-numeric: tabular-nums; }
.year-stat { display: inline-flex; gap: 10px; white-space: nowrap; }
.activity-totals { display: contents; }
.activity-period-heading { position: relative; margin-left: auto; font-size: .875rem; font-weight: 430; line-height: 1.5; }
.activity-period-heading > .activity-period { position: absolute; inset: 0; }
.activity-period-placeholder { display: inline-flex; align-items: center; gap: 5px; visibility: hidden; white-space: nowrap; }
.activity-period-dates { display: none; }
.activity-period-heading .activity-period-dates { display: inline; }
.activity-period-heading .activity-period-label { display: none; }
.activity-period-footer { display: inline-flex; }
.activity-period { display: inline-flex; position: relative; font-size: .875rem; font-weight: 430; line-height: 1.5; }
.activity-period-button { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 6px; background: transparent; padding: 3px 5px; margin: -3px -5px; font: inherit; color: var(--muted); white-space: nowrap; }
.activity-period-button:hover, .activity-period-button[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
.activity-period-menu { position: fixed; inset: auto; margin: 0; z-index: 31; width: 160px; max-height: calc(100dvh - 16px); overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); }
.activity-period-menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 6px; font: inherit; font-size: .85rem; color: var(--ink); background: transparent; text-align: left; }
.activity-period-menu button:hover { background: var(--soft); }
.activity-period-menu [aria-checked="false"] span { visibility: hidden; }
@media (pointer: coarse) {
    .activity-period-menu button { min-height: 44px; }
    .activity-period-button::before { content: ""; position: absolute; inset: -10px 0; }
}
.activity-legend { display: flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.activity-legend i { width: 11px; height: 11px; border-radius: 50%; background: transparent; }
.activity-tooltip { position: fixed; z-index: 30; pointer-events: none; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-size: .75rem; line-height: 1.4; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.home-sticky-header { position: sticky; top: var(--app-header-height, 61px); z-index: 20; background: var(--bg); padding: 0 var(--page-gutter); margin: 0 calc(-1 * var(--page-gutter)); }
#expand-activity { display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--line); }
#expand-activity:hover { color: var(--ink); background: var(--soft); }
.home-tab-heading { border-top: 1px solid var(--line); margin-top: 0; padding: 16px 0; margin-bottom: 0; min-height: 72px; flex-wrap: nowrap; }
.home-tabs { display: flex; gap: 24px; }
.home-tabs button { position: relative; padding: 6px 0; border: 0; background: transparent; border-radius: 0; font-size: 1.25rem; font-weight: 550; line-height: 1.4; color: var(--muted); }
.home-tabs button[aria-selected="true"] { color: var(--ink); }
.home-tabs button[aria-selected="true"]::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--accent); }
.home-tab-heading .refresh-actions { margin-left: auto; flex-wrap: nowrap; }
.home-workouts { gap: 0; }
.home-workouts .home-section-heading, .progress-heading { min-height: 40px; margin-bottom: 16px; }
#refresh-home { width: 40px; height: 40px; min-height: 40px; flex-basis: 40px; }
.home-tab-heading .primary-action, .earlier-days { min-height: 40px; }
.home-tab-heading .primary-action { height: 40px; font-size: .85rem; font-weight: 550; padding: 0 14px; border: 0; }
:root[data-band-theme="classic"] #new-workout-button { background: var(--band-stripe-blue); color: #ffffff; }
.day-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.workout-month-divider { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin: 12px 0 0; font-size: .85rem; line-height: 1.5; font-weight: 500; color: var(--muted); }
.workout-month-divider:first-child { margin-top: 0; }
.workout-month-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.day-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--card-radius); padding: 14px; min-width: 0; }
.day-card-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.day-card-heading h3, .day-card-heading h4 { margin: 0; font-size: .85rem; line-height: 1.5; font-weight: 550; color: var(--muted); }
.day-card-today { --day-accent: var(--accent); border-color: var(--day-accent); box-shadow: inset 0 0 0 3px var(--day-accent); }
:root[data-band-theme="classic"] .day-card-today { border-color: var(--band-stripe-red); box-shadow: inset 0 0 0 2px var(--band-stripe-red), inset 0 0 0 5px var(--band-primary), inset 0 0 0 8px var(--band-stripe-blue); }
.day-card-today .day-card-heading h3, .day-card-today .day-card-heading h4 { color: var(--ink); }
.day-card-selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.day-card-selected .day-card-heading h3, .day-card-selected .day-card-heading h4 { color: var(--ink); }
.day-workout-count { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.day-workout { display: block; text-align: left; width: 100%; padding: 12px 0; background: transparent; color: var(--ink); border: 0; border-top: 1px solid var(--line); }
.day-workout:last-child { padding-bottom: 2px; }
.day-workout:hover { background: var(--soft); }
.home-workout-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--muted); font-size: .75rem; margin-bottom: 12px; }
.home-workout-meta time { min-width: 0; }
.home-workout-volume { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-workout-summary { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
.home-workout-summary > .empty-state { grid-column: 1 / -1; }
.home-exercise-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); column-gap: 6px; grid-column: 1 / -1; align-items: start; font-size: .8rem; line-height: 1.6; }
.home-exercise-name { min-width: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-set-groups { display: grid; width: max-content; max-width: 100%; min-width: 0; grid-column: 2; justify-self: end; font: inherit; font-variant-numeric: tabular-nums; color: inherit; }
.home-set-line { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; align-items: baseline; white-space: nowrap; }
.home-set-cell { padding-left: 6px; }
.home-set-cell:first-child, .home-fraction { padding-left: 0; }
.home-integer { text-align: right; }
.home-fraction, .home-unit { text-align: left; }
.home-symbol { text-align: center; }
.home-set-empty { grid-column: 1 / -1; text-align: right; white-space: nowrap; }
.home-exercise-note { grid-column: 1 / -1; justify-self: end; width: 66.666%; margin: 3px 0 1px; color: var(--muted); font-size: .75rem; line-height: 1.45; font-weight: 500; text-align: right; white-space: pre-wrap; overflow-wrap: anywhere; }
.earlier-days { display: block; margin: 24px auto 0; background: var(--panel); font-size: .85rem; font-weight: 500; }

.day-card-grid > .empty-state { grid-column: 1 / -1; }
#history-layout { min-height: 40px; margin: 0; padding-inline: 6px; }
.day-card-grid.weekly-history { display: flex; flex-direction: column; gap: 14px; container: history-weeks / inline-size; }
.history-week { display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(min(172px, 100%), 1fr)); gap: 14px; align-items: start; }
.history-week-standard { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.weekly-history .day-card { container: weekly-card / inline-size; }
.weekly-history .home-workout-meta { flex-wrap: wrap; gap: 4px 12px; }
.weekly-history .home-exercise-row { grid-template-columns: minmax(0, 1fr) max-content; }
.earlier-days.earlier-weeks { margin: 0 auto 14px; }
@container history-weeks (min-width: 1242px) {
    .history-week-standard { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@container history-weeks (max-width: 543px) {
    .history-week-standard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container history-weeks (max-width: 357px) {
    .history-week-standard { grid-template-columns: minmax(0, 1fr); }
}
@container weekly-card (max-width: 160px) {
    .weekly-history .home-exercise-row { grid-template-columns: minmax(0, 1fr); }
    .weekly-history .home-set-groups { grid-column: 1; justify-self: start; }
    .weekly-history .home-exercise-note { width: 100%; }
}
@media (max-width: 480px) {
    .home-tab-heading { flex-wrap: wrap; }
}
@media (max-width: 960px) { .day-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    .day-card-grid { grid-template-columns: minmax(0, 1fr); }
    .top-bar { gap: 12px; }
    .brand { font-size: .85rem; }
    .title-button { gap: 7px; }
    .account-menu-panel { max-height: calc(100dvh - 170px); }
    .theme-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .activity-range { margin-left: 0; }
    .activity-footer { gap: 12px; }
    .home-tabs { gap: 16px; }
    .home-tabs button { font-size: 1rem; }
    .home-tab-heading { gap: 8px; }
    .home-tab-heading .primary-action { padding-inline: 10px; }
    .home-tab-heading .refresh-actions { gap: 4px; }
}

.activity-period-menu [data-period="custom"] { border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: 5px; }
.date-range-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.date-range-dialog::backdrop { background: rgb(0 0 0 / .5); }
body:has(.date-range-dialog[open]) { overflow: hidden; }
.date-range-dialog form { padding: 26px; }
.date-range-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.date-range-heading h2 { margin: 0; font-size: 1.4rem; font-weight: 600; text-transform: none; letter-spacing: normal; white-space: nowrap; }
.date-range-summary { margin: 2px 0 0; color: var(--muted); font-size: .8rem; text-align: right; line-height: 1.5; max-width: 65%; }
.date-range-dialog fieldset { padding: 0; margin: 0 0 22px; border: 0; min-width: 0; }
.date-range-dialog legend { padding: 0; margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.date-range-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.date-range-presets[data-range-group="Calendar"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.date-range-presets button, .date-range-fields input { min-width: 0; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: transparent; font-size: .95rem; }
.date-range-presets button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.date-range-presets button:hover:not(:disabled) { background: var(--soft); }
.date-range-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border-top: 1px solid var(--line); padding-top: 22px; }
.date-range-fields label { display: grid; gap: 10px; color: var(--muted); font-size: .9rem; text-transform: none; letter-spacing: normal; }
.date-range-fields input { min-height: 52px; }
.date-range-error { margin: 10px 0 0; font-size: .85rem; color: var(--danger); }
.date-range-error:empty { display: none; }
.date-range-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 18px; margin-top: 24px; border-top: 1px solid var(--line); }
.date-range-actions button { min-height: 44px; padding: 10px 22px; border: 0; border-radius: 9px; }
.date-range-actions [data-range-cancel] { background: transparent; color: var(--ink); }
@media (max-width: 480px) {
    .date-range-dialog form { padding: 18px; }
    .date-range-heading { gap: 10px; }
    .date-range-heading h2 { font-size: 1.2rem; }
    .date-range-summary { font-size: .75rem; }
    .date-range-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .date-range-presets button, .date-range-fields input { font-size: .85rem; padding-inline: 8px; }
    .date-range-fields { gap: 10px; }
}

/* Logbook shares the day cards and actions, with room to read each exercise. */
.day-card-grid.logbook-history { display: block; min-width: 0; }
.history-logbook { container: logbook / inline-size; }
.logbook-track { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% + 14px) / var(--logbook-columns, 3) - 14px); gap: 14px; align-items: start; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding-bottom: 18px; }
.logbook-track > .day-card { padding: 20px; scroll-snap-align: start; container: logbook-card / inline-size; }
.logbook-history .day-card-heading { margin-bottom: 14px; }
.logbook-history .day-card-heading h3 { font-size: 1rem; }
.logbook-history .day-workout { padding-top: 14px; }
.logbook-history .day-workout + .day-workout { margin-top: 22px; }
.logbook-history .home-workout-meta { flex-wrap: wrap; gap: 4px 10px; margin-bottom: 22px; }
.logbook-history .home-workout-summary { row-gap: 24px; }
.logbook-history .home-exercise-row { grid-template-columns: minmax(0, 1fr) max-content; gap: 4px 12px; }
.logbook-history .home-exercise-name { grid-column: 1; font-size: 26px; line-height: 1.2; font-weight: 700; white-space: normal; overflow-wrap: anywhere; color: var(--ink); }
.logbook-history .home-set-groups { grid-column: 1; grid-row: 2; justify-self: start; font-size: 22px; line-height: 1.45; font-weight: 400; color: color-mix(in srgb, var(--ink) 55%, var(--muted)); }
.logbook-comparison { display: grid; grid-column: 2; grid-row: 1 / 3; align-self: center; gap: 4px; text-align: right; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: nowrap; font-variant-numeric: tabular-nums; }
.logbook-history .home-exercise-note { width: 100%; text-align: left; }
@container logbook-card (max-width: 260px) {
    .logbook-history .home-exercise-name, .logbook-history .home-set-groups { grid-column: 1 / -1; }
    .logbook-comparison { grid-column: 1 / -1; grid-row: 3; display: flex; gap: 12px; text-align: left; }
    .logbook-history .home-set-groups { display: block; width: auto; }
    .logbook-history .home-set-line { display: flex; flex-wrap: wrap; }
}

.kiosk-view:has(.activity-pinned:not([hidden])) { row-gap: 0; }
.page-content:has(> .activity-pinned:not([hidden])) { padding-top: 0; }
.activity-pinned .home-sticky-header { padding-top: var(--page-gutter); }
