.shell { min-height: 100%; display: flex; flex-direction: column; overflow-x: clip; }

/*
 * Шапка прилипает с отступом от края, а не с самого верха: Safari на iPhone
 * заливает зону под часами сплошным цветом, если у верхнего края экрана
 * висит закреплённый блок, — без него там родное размытие страницы.
 */
.topbar {
    --topbar-gap: calc(14px + env(safe-area-inset-top));
    position: sticky;
    top: var(--topbar-gap);
    z-index: 20;
    margin-top: var(--topbar-gap);
    padding: 0 20px;
    pointer-events: none;
}
.topbar__inner, .topbar .theme-switch { pointer-events: auto; }
/* «Бровь»: узкая шапка по центру — вкладки одной ширины и тема. */
.topbar__inner {
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 6px;
    border-radius: var(--pill);
    background: var(--nav);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-nav);
}
.nav { --tab-w: 124px; --tab-h: 42px; --tab-gap: 4px; position: relative; display: flex; gap: var(--tab-gap); }
.nav__tab {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: var(--tab-w);
    height: var(--tab-h);
    padding: 0 12px;
    border: 0;
    border-radius: var(--pill);
    background: none;
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav__tab:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav__icon { display: none; }
.nav__icon svg { width: 23px; height: 23px; stroke-width: 1.7; }
.avatar--nav { width: 24px; height: 24px; font-size: 10px; }
.nav__thumb {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: var(--tab-w);
    height: var(--tab-h);
    overflow: hidden;
    border-radius: var(--pill);
    background: var(--tab-bg);
    pointer-events: none;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav__row { position: absolute; top: 0; left: 0; display: flex; gap: var(--tab-gap); transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
.nav__tab--on, .nav__tab--on:hover { color: var(--tab-ink); background: none; }
.nav__tab--on .avatar--nav { background: var(--tab-ink); color: var(--tab-bg); }
.nav .badge { position: absolute; top: 2px; right: 8px; z-index: 2; margin: 0; }
.topbar__theme { display: inline-flex; margin-left: 4px; padding: 0 6px 0 10px; border-left: 1px solid var(--line); }
@media (max-width: 780px) {
    .nav { --tab-w: min(58px, calc((100vw - 52px) / 5)); --tab-h: 46px; }
    .nav__tab { padding: 0; }
    .nav__label { display: none; }
    .nav__icon { display: inline-flex; }
    .avatar--nav { width: 30px; height: 30px; font-size: 11px; }
    .topbar__theme { display: none; }
    .nav .badge { right: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .nav__thumb, .nav__row { transition: none; }
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 14px 4px 4px;
    border: none;
    border-radius: var(--pill);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow 0.18s var(--ease);
}
.profile-chip:hover { box-shadow: var(--shadow-card); }
.profile-chip[aria-current="page"] { background: var(--ink); color: var(--on-accent); }

.notice-bar { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 0 20px; }
.notice-bar .notice { margin: 18px 0 0; }

.page { transition: transform 0.34s var(--ease); }
.page--top {
    position: relative;
    z-index: 15;
    background: var(--bg);
    box-shadow: var(--shadow-stack);
}
.page--peek {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    overflow: hidden;
    background: var(--bg);
}
.page--peek::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--scrim);
    opacity: calc(1 - var(--peek-progress, 1));
    pointer-events: none;
}
.is-swiping .float { opacity: 0; }

.page {
    flex: 1;
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 22px 20px calc(40px + env(safe-area-inset-bottom));
}

.auth-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    padding: 24px 20px calc(60px + env(safe-area-inset-bottom));
}
.auth-tools { width: 100%; max-width: 380px; display: flex; justify-content: flex-end; }
.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 30px 28px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
}
.auth-card__title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    margin: 0 0 6px;
}
.auth-card__sub {
    text-align: center;
    color: var(--ink-muted);
    font-size: 12px;
    margin: 0 0 22px;
}
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    max-width: 780px;
}
@media (min-width: 900px) {
    .profile-grid { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
}
.profile-grid .card { margin-bottom: 0; }

.me { display: flex; flex-direction: column; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head__who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile-head__name { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.profile-head__role { color: var(--ink-muted); font-size: 13px; }

.me-rows {
    display: flex;
    flex-direction: column;
    margin-top: 22px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    overflow: hidden;
}
.me-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 14px;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    text-align: left;
}
.me-row + .me-row { border-top: 1px solid var(--line); }
.me-row--tap { cursor: pointer; }
.me-row--tap:hover { background: color-mix(in srgb, var(--line) 45%, transparent); }
.me-row__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--accent-strong);
}
.me-row__icon svg { width: 18px; height: 18px; }
.me-row__label { font-weight: 500; }
.me-row__value { color: var(--ink-muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.me-row__value--mono { font-family: var(--font-mono); font-size: 13px; }
.me-row__value--warn { color: var(--warn); }
.me-row__go { display: inline-flex; color: var(--ink-muted); }
.me-row__theme { display: inline-flex; }
@media (min-width: 781px) {
    .me-row--theme { display: none; }
}

.me-end { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: auto; padding-top: 24px; }
.btn--end {
    justify-content: center;
    width: 100%;
    padding: 14px 18px;
    border-color: var(--ink);
    background: var(--ink);
    color: var(--surface);
    font-size: 15px;
}
.btn--end:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
.me-end__hint { margin: 0; text-align: center; color: var(--ink-muted); font-size: 12px; line-height: 1.45; }
.me-end__logout { align-self: center; }

.me-photo { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.me-photo .avatar--xl { width: 120px; height: 120px; font-size: 36px; }
.me-photo .muted--hint { margin: 0; }
.me-photo__pick { cursor: pointer; }
.me-note { margin: 0; font-size: 14px; line-height: 1.5; }

@media (max-width: 780px) {
    .topbar { --topbar-gap: calc(10px + env(safe-area-inset-top)); padding: 0 12px; }
    .profile-chip { padding: 4px; }
    .profile-chip__name { display: none; }

    .notice-bar { padding: 0 12px; }
    .page { padding: 16px 12px calc(32px + env(safe-area-inset-bottom)); touch-action: pan-y pinch-zoom; }
    .card { padding: 18px 16px; border-radius: var(--radius-md); }
    .table-scroll { margin: 0 -16px; padding: 0 16px; }
    .auth-card { padding: 24px 18px; }

}


.topbar {
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
    will-change: transform;
}
.topbar__inner { transition: box-shadow 0.42s cubic-bezier(0.22, 1, 0.36, 1), transform 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
/*
 * Спрятанная шапка только растворяется на своём месте и становится
 * невидимой — не сдвигается ни на пиксель: блок, коснувшийся зоны под
 * часами, Safari 26 заливает сплошной полосой (проверено на iPhone
 * страницами web/lab, вариант H; сдвиг на 10 px полосу не убрал).
 */
.topbar--hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.topbar--hidden .topbar__inner, .topbar--hidden .theme-switch { pointer-events: none; }
.topbar--hidden .topbar__inner { transform: scale(0.96); box-shadow: none; }
.desk__side { transition: top 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
.nav-hidden .desk__side { top: 14px; }
@media (prefers-reduced-motion: reduce) {
    .topbar, .topbar__inner, .desk__side { transition: none; }
}

.shifts-card { display: flex; flex-direction: column; }
.shifts-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.shifts-card__head .section__title { margin: 0; }
.cal__nav { display: flex; align-items: center; gap: 4px; }
.cal__month { min-width: 136px; text-align: center; font-size: 14px; font-weight: 600; }

.me-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 16px 0;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}
.me-fact { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 0 18px; }
.me-fact + .me-fact { border-left: 1px solid var(--line); }
.me-fact strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.15; color: var(--ink); }
.me-fact span { font-size: 13px; color: var(--ink-muted); line-height: 1.35; }
.me-fact small { font-size: 12px; color: var(--warn); white-space: nowrap; }
.me-fact--late strong { color: var(--warn); }
.me-facts > .muted { padding: 0 18px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 18px; }
.cal__head { font-size: 12px; color: var(--ink-muted); text-align: center; padding-bottom: 4px; }
.cal__cell {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 54px; border-radius: 12px; border: 1px solid transparent; background: none;
    font: inherit; color: var(--ink); padding: 2px;
}
.cal__cell--pad { visibility: hidden; }
.cal__day { font-size: 14px; }
.cal__hours { font-size: 11px; }
.cal__cell--work { background: var(--ok-soft); color: var(--ok); cursor: pointer; }
.cal__cell--work .cal__day { font-weight: 600; }
.cal__cell--late { background: var(--warn-soft); color: var(--warn); }
.cal__cell--today { border-color: var(--ink-muted); }
.cal__cell--picked { outline: 2px solid currentColor; outline-offset: -2px; }
.cal__picked { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-sunken); font-size: 14px; }
.cal__picked strong::first-letter { text-transform: uppercase; }
.cal__late { color: var(--warn); }
.cal__hint { margin: 14px 0 0; font-size: 12px; color: var(--ink-muted); }
@media (max-width: 780px) {
    .me-facts { padding: 14px 0; }
    .me-fact { padding: 0 12px; }
    .me-fact strong { font-size: 18px; }
    .me-fact span { font-size: 12px; }
    .cal { gap: 4px; }
    .cal__cell { min-height: 46px; }
    .cal__day { font-size: 13px; }
    .cal__hours { font-size: 10px; }
    .me-row__value { max-width: 130px; }
    .shifts-card__head .cal__nav { width: 100%; justify-content: space-between; }
}
.me-note--rows { margin-top: 14px; font-size: 13px; }
