/* Compact content-first layout. Navigation geometry belongs to the existing shell. */
:root { --layout-gap: 8px; --layout-block: 16px; }
.screen { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.is-telegram .screen { padding-top: calc(8px + var(--tg-top, 0px)); }
.screen > .headline, #work-view > .headline { min-height: 44px; margin: 0 0 12px; flex: none; }
.screen__scroll { padding-bottom: 16px; }
.view-select { appearance: none; border: 0; border-radius: 0; background: transparent; color: var(--text); font-size: 22px; font-weight: 650; max-width: 100%; padding: 4px 28px 4px 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23888888' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 4px center; }
.view-select option { background: var(--surface); color: var(--text); font-size: 17px; }
#screen-home > .headline { gap: 8px; }
#home-view-select { flex: 1; min-width: 0; }
.headline__actions { gap: 0; flex: none; }
.home-date { margin: 4px 0 12px; font-size: 16px; font-weight: 400; }
.priority-row { padding: 16px 0; }
.priority__title { font-size: 18px; font-weight: 550; line-height: 1.45; }
.priority { gap: 8px; }
.priority__body { min-width: 0; }
.day-brief { margin-top: 16px; }
.work-head { gap: 4px; }
.work-head .work-kinds { flex: 1; min-width: 0; margin: 0; gap: 0; }
.work-kinds .subtab { min-width: 0; padding: 8px; font-size: 16px; border-radius: 0; border: 0; }
.work-kinds .subtab--active { color: var(--text); background: transparent; box-shadow: inset 0 -2px var(--text); }
.work-head__controls { flex: none; }
.task-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.task-tools .search-field { flex: 1; min-width: 0; margin: 0; }
.task-tools input { padding: 8px 12px; }
.task-tools .compact-select { width: 112px; max-width: 42%; margin: 0; flex: none; font-size: 16px; padding-left: 10px; padding-right: 26px; background-position: right 6px center; }
.task-row__title { font-size: 17px; font-weight: 500; }
.task-meta { font-size: 15px; }
.goal-period { margin: 0 0 8px; font-size: 16px; }
.card.goal { padding: 16px 0; margin: 0; }
.goal__head { gap: 0; }
.goal__title { font-size: 19px; font-weight: 600; }
.goal__sub { font-size: 16px; margin-top: 8px; line-height: 1.45; }
.rm { margin: 12px 0 0; padding: 0; }
.rm__row { gap: 8px; }
.rm__title { font-size: 17px; line-height: 1.45; white-space: normal; overflow: visible; text-overflow: clip; }
.rm__due { font-size: 15px; }
.goal__path-title { font-size: 20px; line-height: 1.3; white-space: normal; overflow: visible; text-overflow: clip; min-width: 0; }
.goal__path.card { border: 0; background: transparent; padding: 0; margin: 0; }
.goal__bar-label, .goal__bar-pct { font-size: 16px; }
.goal__ms { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 8px; padding: 12px 0; margin: 0; }
.milestone-block { border-bottom: 1px solid var(--border); }
.milestone-check { border: 0; background: transparent; color: var(--text); width: 44px; display: grid; place-items: center; padding: 0; }
.goal__ms-title { font-size: 18px; font-weight: 500; line-height: 1.4; }
.goal__ms--next .goal__ms-title { color: var(--text); font-weight: 600; }
.goal__ms-sub { font-size: 15px; margin-top: 4px; color: var(--text-2); opacity: 1; }
.goal__ms--done { opacity: 1; }
.goal__ms--done .goal__ms-title { color: var(--text-2); opacity: 1; }
.goal__ms-more { border: 0; background: transparent; color: var(--text-2); font-size: 24px; padding: 0; }
.milestone-details { padding: 0 0 12px 52px; }
.milestone-details > summary, .inline-add > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 16px; color: var(--text-2); list-style: none; gap: 8px; }
.milestone-details > summary::after { content: '+'; margin-left: auto; padding-right: 16px; }
.milestone-details[open] > summary::after { content: '−'; }
.milestone-details > summary::-webkit-details-marker, .inline-add > summary::-webkit-details-marker { display: none; }
.milestone-criterion { font-size: 16px; line-height: 1.5; margin: 8px 0 16px; }
.goal__actions { margin: 0; padding: 0; border: 0; }
.action-row { align-items: start; gap: 8px; padding: 12px 0; }
.action-row__title { font-size: 17px; line-height: 1.4; }
.action-row__done, .action-row__meta, .action-check { font-size: 15px; line-height: 1.45; }
.goal__add-ms { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 8px; padding: 8px 0 16px; margin: 0; }
.goal__add-ms input:first-child { grid-column: 1 / -1; }
.goal__add-action { grid-template-columns: minmax(0,1fr) 76px 44px; }
.goal__add-ms .goal__input { width: 100%; max-width: 100%; }
.inline-add { margin: 0; }
#body-view > .subtabs, #fuel-view > .subtabs { margin: 0 0 12px; flex: none; }
#body-view > .subtabs .subtab, #fuel-view > .subtabs .subtab { font-size: 16px; padding: 8px; border-radius: 0; border: 0; }
#body-view > .subtabs .subtab--active, #fuel-view > .subtabs .subtab--active { background: transparent; color: var(--text); box-shadow: inset 0 -2px var(--text); }
.workout-next { padding: 16px 0; }
.workout-next__date { font-size: 16px; color: var(--text-2); }
.workout-next__title { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; padding: 8px 0 16px; width: 100%; background: none; color: var(--text); font-size: 24px; font-weight: 650; text-align: left; line-height: 1.3; }
.workout-next__title span { font-size: 24px; color: var(--text-2); }
.workout-week { padding: 8px 0 24px; font-size: 16px; color: var(--text-2); }
.workout-link, .workout-disclosure > summary { width: 100%; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; padding: 16px 0; min-height: 56px; display: flex; justify-content: space-between; gap: 16px; font-size: 18px; color: var(--text); text-align: left; cursor: pointer; }
.workout-link span:last-child { color: var(--text-2); }
#body-view .detail-head { margin: 0 0 12px; min-height: 44px; flex: none; }
#body-view .detail-head__title { min-width: 0; overflow-wrap: anywhere; font-size: 20px; line-height: 1.3; }
#body-view .screen-cta { margin-top: 12px; flex: none; }
.workout-head { gap: 8px; }
.workout-head .detail-head__title { flex: 1; }
.workout-finish { border: 0; padding: 8px; font-size: 15px; flex: none; color: var(--text-2); background: none; }
#body-view .wo-row { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding: 16px 0; margin: 0; gap: 8px; }
.wo-row__main { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); padding: 0; text-align: left; }
.wo-row__main .wo-row__title, .wo-row__main .wo-row__val { display: block; }
.wo-row__title { font-size: 18px; font-weight: 550; line-height: 1.4; overflow-wrap: anywhere; }
.wo-row__val { font-size: 17px; line-height: 1.5; margin-top: 4px; }
.wo-row__actions { gap: 4px; }
.wo-swap, .wo-done { width: 44px; min-width: 44px; padding: 8px; font-size: 22px; }
.control-view { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: 44px minmax(0,1fr); gap: 12px 4px; }
.control-kinds { min-height: 44px; margin: 0; gap: 0; min-width: 0; }
.control-kinds .subtab { font-size: 15px; padding: 8px 4px; border-radius: 0; border: 0; background: none; color: var(--text-2); }
.control-kinds .subtab--active { color: var(--text); box-shadow: inset 0 -2px var(--text); }
.control-toolbar { min-height: 44px; padding: 0; gap: 0; }
.control-status-filter { max-width: 104px; padding-left: 8px; font-size: 15px; }
.control-add { width: 44px; min-width: 44px; padding: 8px; font-size: 24px; }
.control-list { grid-column: 1 / -1; }
.control-list { padding-top: 0; }
.control-row__title { font-size: 18px; }
.control-status, .control-deadline { font-size: 15px; }
.control-source-link { font-size: 16px; }
@media (max-width: 360px) {
 .work-kinds .subtab, #body-view > .subtabs .subtab { font-size: 15px; padding-inline: 4px; }
 .view-select { font-size: 20px; }
 .control-view { grid-template-columns: minmax(0,1fr); grid-template-rows: 44px 44px minmax(0,1fr); gap: 4px; }
 .control-toolbar { justify-content: flex-end; }
}
@media (min-width: 900px) {
 .screen { padding: 20px 32px 16px; }
 .screen > .headline, .screen > .screen__scroll, #work-view, #body-view, #fuel-view, #chat-view { max-width: none; }
 .task-tools .compact-select { width: 144px; }
}

.goal__ms-more { opacity: 1; }
.goal__ms-edit { flex-wrap: wrap; margin-left: 52px; }
.goal__ms-edit .goal__input { flex-basis: 100%; }
.goal__ms-edit .goal__btn--danger { color: #ff9095; }
:root[data-theme="light"] .goal__ms-edit .goal__btn--danger { color: #a51e29; }

/* Feedback from actual Mini App use: compact controls and explicit pending saves. */
:root { --focus: var(--text); }
:root[data-theme="light"] { --focus: var(--text); }
.view-select:focus, .view-select:focus-visible { outline: none; box-shadow: none; }
.keyboard-focus .view-select:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[aria-busy="true"].priority-row, [aria-busy="true"].habit-row { opacity: .7; }
#progress-filters { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
#progress-filters > .compact-select { flex: 0 1 164px; min-width: 0; max-width: 48%; width: 164px; }
#progress-filters > .subtabs { flex: 1; min-width: 0; margin: 0; gap: 0; }
#progress-filters .subtab { flex: 0 0 auto; padding: 8px 4px; min-width: 0; font-size: 15px; border: 0; border-radius: 0; overflow: visible; text-overflow: clip; }
#progress-filters .subtab--active { background: none; color: var(--text); box-shadow: inset 0 -2px var(--text); }
.task-tools { align-items: start; }
.task-tools .form-field, .task-tools input, .task-tools select { margin-block: 0; height: 44px; }
.task-tools .form-field { display: block; }
.task-tools input { display: block; }
.tg--day { padding: 0 16px; }
.tg__body--day, .tg__allday--day { padding: 0; grid-template-columns: 44px minmax(0,1fr); }
.tg__ev--day .tg__ev-title { font-size: 15px; }
.tg__ev--day .tg__ev-time { font-size: 13px; }
.fuel__empty h2 { font-size: 20px; margin: 8px 0; font-weight: 600; }
.fuel-trend-link { color: var(--text); font-size: 17px; }
#free-sets { margin-top: 16px; }
@media(max-width:360px){#progress-filters { flex-wrap: wrap; } #progress-filters > .compact-select { max-width: 100%; width: 100%; flex-basis: 100%; }}

.progress-summary__label { color: var(--text); font-size: 16px; }
.tg--day .tg__allday-ev { font-size: 14px; }
