body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
/* Нижняя панель .tabbar — в shared.css; тосты поднимаем над ней */
.toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
.settings-logout { width: 100%; margin-top: 4px; }
/* Шапки нет: сверху только вырез экрана iPhone — закрываем его фоном, чтобы контент не просвечивал под часами */
body { padding-top: env(safe-area-inset-top); }
body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); z-index: 30; background: var(--bar); }
.tabs { position: sticky; top: env(safe-area-inset-top); z-index: 9; display: grid; grid-template-columns: repeat(5, 1fr) 40px; gap: 6px; padding: 10px 16px; background: var(--bar); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.tab-refresh { display: grid; place-items: center; padding: 0; color: var(--muted); }
.tab-refresh svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab-refresh.is-spinning svg { animation: clock-spin .7s linear infinite; }
.tabs[hidden] { display: none; }
.sheet .btn[aria-current="true"] { border-color: var(--gold); color: var(--gold); }
.tab { min-height: 40px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-weight: 700; font-size: 13.5px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; max-width: 640px; margin: 0 auto; scrollbar-width: none; }
.filters[hidden] { display: none; }
.chip-btn { flex-shrink: 0; min-height: 34px; padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: none; font-size: 13px; font-weight: 700; cursor: pointer; }
.chip-btn[aria-pressed="true"] { border-color: var(--gold); background: var(--accent-soft); color: var(--gold); }
.summary { color: var(--muted); font-size: 13px; }
.summary b { color: var(--amber); }
.tab[aria-pressed="true"] { background: var(--accent-grad); color: var(--on-accent); border-color: var(--accent-line); }
.list { display: grid; gap: 12px; padding: 12px 16px 32px; max-width: 640px; margin: 0 auto; }
.day-head { margin: 10px 0 0; color: var(--gold); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.order { position: relative; overflow: hidden; padding: 14px 14px 12px 18px; }
.order::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.order.t-empty::before { background: var(--red); } .order.t-partial::before { background: var(--amber); } .order.t-full::before { background: var(--green); } .order.t-none::before { background: var(--line-2); }
.order.is-new { box-shadow: 0 0 0 2px var(--gold) inset; }
.o-time { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.o-time small { color: var(--muted); font-size: 14px; font-weight: 600; }
.o-title { margin: 2px 0 6px; font-size: 17px; font-weight: 800; }
.o-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 13px; }
.o-note { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: var(--soft); font-size: 13.5px; }
.slots { display: grid; gap: 8px; margin-top: 12px; }
.slot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.slot-label { font-size: 13px; color: var(--muted); }
.slot-who { font-weight: 700; }
.slot.mine { border-color: var(--green-line); background: var(--mine-bg); }
.btn-take { min-width: 104px; min-height: 44px; font-size: 15px; }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; font-size: 14px; }
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: var(--scrim); }
.themes { display: grid; gap: 10px; }
.theme-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); text-align: left; cursor: pointer; }
.theme-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.theme-preview { flex-shrink: 0; display: grid; place-items: center; width: 78px; height: 54px; border-radius: 6px; border: 1px solid var(--line-2); }
.theme-preview > span { display: grid; gap: 4px; width: 56px; padding: 6px; border: 1px solid; border-radius: 4px; }
.theme-preview i { display: block; height: 5px; border-radius: 3px; }
.theme-preview i:last-child { width: 70%; opacity: .7; }
.sheet .card { width: 100%; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; border-radius: 14px 14px 0 0; }

/* ---- Лента ---- */
.feed { display: grid; gap: 12px; }
.composer { display: grid; gap: 10px; padding: 12px; }
.composer-row { display: flex; gap: 10px; align-items: flex-start; }
.composer-row textarea { resize: vertical; min-height: 64px; font: inherit; font-size: 15px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.composer-photo-btn { cursor: pointer; }
.composer-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.composer-photos:empty { display: none; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: #000a; color: #fff; font-size: 12px; cursor: pointer; }
.thumb-loading { display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.feed-filters { display: flex; gap: 6px; }
.feed-news { position: sticky; top: calc(10px + env(safe-area-inset-top)); z-index: 8; justify-self: center; box-shadow: 0 6px 18px #0008; }
.feed-more { width: 100%; }
.post { display: grid; gap: 10px; padding: 12px 14px; }
.post.is-pinned { border-color: var(--gold); }
.pin-label { color: var(--gold); font-size: 12px; font-weight: 800; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-who { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.post-who .muted { font-size: 12.5px; }
.post-menu { font-size: 18px; }
.post-text { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.post-text a, .comment-body a { color: var(--gold); }
.post-edit { display: grid; gap: 8px; }
.post-edit textarea { font: inherit; font-size: 15px; resize: vertical; }
.photos { display: grid; gap: 4px; border-radius: 10px; overflow: hidden; }
.photos.n1 { grid-template-columns: 1fr; }
.photos.n2, .photos.n4 { grid-template-columns: 1fr 1fr; }
.photos.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.photos.n3 .photo:first-child { grid-row: span 2; }
.photo { position: relative; padding: 0; border: 0; background: var(--soft); cursor: zoom-in; aspect-ratio: 1; overflow: hidden; }
.photos.n1 .photo { aspect-ratio: auto; max-height: 460px; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos.n1 .photo img { object-fit: contain; max-height: 460px; background: #000; }
.photo.extra { display: none; }
.photo-more { position: absolute; inset: 0; display: grid; place-items: center; background: #0009; color: #fff; font-size: 22px; font-weight: 800; }
.photo-view { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: #000e; }
.photo-view img { max-width: 100%; max-height: 100%; object-fit: contain; }
.photo-view .btn { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.react { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: none; color: inherit; font-size: 14px; cursor: pointer; }
.react b { font-size: 12.5px; }
.react.mine { border-color: var(--gold); background: var(--accent-soft); }
.react-add { color: var(--muted); font-size: 13px; }
.react-picker { display: inline-flex; gap: 4px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); }
.react-picker .react { border: 0; font-size: 18px; padding: 2px 6px; }
.post-foot { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 6px; margin: 0 -4px; }
.post-reads { color: var(--muted); }
.comments { display: grid; gap: 10px; }
.comment { display: flex; gap: 8px; }
.comment .ava { width: 30px; height: 30px; font-size: 11px; }
.comment-body { position: relative; flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--soft); font-size: 14px; overflow-wrap: anywhere; }
.comment-body .muted { font-size: 12px; }
.comment-del { position: absolute; top: 4px; right: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.comment-form { display: flex; gap: 6px; }
.comment-form .btn { min-width: 44px; }
.event { display: flex; gap: 10px; padding: 8px 4px 8px 6px; border-left: 2px solid var(--line-2); margin-left: 14px; }
.ev-icon { flex-shrink: 0; width: 26px; text-align: center; font-size: 17px; line-height: 1.3; }
.ev-body { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.ev-order { color: var(--ivory); opacity: .85; font-size: 13px; }
.ev-extra { color: var(--muted); font-size: 13px; }
.ev-time { font-size: 12px; }
.event .reacts { margin-top: 4px; }
.event .react { min-height: 26px; padding: 0 8px; font-size: 13px; }
.ev-achievement { border-left-color: var(--gold); }
.ev-booking_done { border-left-color: var(--green); }
.ev-booking_cancelled { border-left-color: var(--red); }
.ev-booking_new { border-left-color: var(--blue); }

/* Карточка аккаунта вверху «Настроек» */
.acc-preview { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.acc-preview:hover, .acc-preview:focus-visible { border-color: var(--gold); background: var(--panel-2); }
.acc-preview:active { transform: scale(.99); }
.acc-preview-text { display: grid; gap: 3px; flex: 1; min-width: 0; }
.acc-preview-text b { font-size: 17px; }
.acc-preview-text .muted { font-size: 13px; }
.acc-preview-go { color: var(--muted); font-size: 28px; line-height: 1; }
.ava-lg { width: 54px; height: 54px; font-size: 18px; }

/* ---- Чат ---- */
.ava-team, .ava-icon { background: var(--accent-soft); color: var(--gold); }
.ava-team svg, .ava-icon svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.acc-admin-link { text-decoration: none; }
/* «Админка» — акцентная карточка, чтобы не сливалась с аккаунтом (цвета из темы: золото / голубой / тёплое золото) */
.acc-admin-link { border-color: var(--accent-line); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--panel); box-shadow: 0 0 0 1px var(--accent-soft) inset; }
.acc-admin-link:hover, .acc-admin-link:focus-visible { border-color: var(--gold); background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft)), var(--panel-2); }
.acc-admin-link .ava-icon { background: var(--accent-grad); color: var(--on-accent); }
.acc-admin-link .acc-preview-text b { color: var(--gold); }
.acc-admin-link .acc-preview-go { color: var(--gold); }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.chat-item.has-unread { border-color: var(--gold); }
.chat-item-main { display: grid; gap: 3px; flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item-top .muted { font-size: 12px; flex-shrink: 0; }
.chat-item-last { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.has-unread .chat-item-last { color: var(--ivory); }
.chat-badge { margin: 0; flex-shrink: 0; }
.chat-hint { font-size: 13px; text-align: center; margin: 8px 0 0; }
.chat-pick { max-height: 80vh; }
.chat-pick-list { display: grid; gap: 4px; overflow: auto; max-height: 60vh; }
.chat-pick-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chat-pick-item:hover { background: var(--soft); }
.chat-pick-item .muted { font-size: 12.5px; }
/* Открытая переписка: шапка чата прилипает сверху, поле ввода — над нижней панелью */
body.in-chat .list { padding-bottom: 0; }
.chat-thread { display: grid; }
.chat-head { position: sticky; top: env(safe-area-inset-top); z-index: 9; margin: -12px -16px 0; background: var(--bar); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.chat-top-title { display: grid; line-height: 1.2; min-width: 0; }
.chat-top-title .muted { font-size: 12px; }
.chat-msgs { display: grid; gap: 2px; padding: 10px 0 96px; }
.chat-older { justify-self: center; margin-bottom: 6px; }
.chat-day { display: flex; justify-content: center; margin: 10px 0 6px; }
.chat-day span { padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 700; }
.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 86%; }
.msg.first { margin-top: 6px; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.msg-ava, .msg-ava-gap { width: 28px; height: 28px; flex-shrink: 0; }
.bubble { position: relative; min-width: 64px; padding: 7px 10px 6px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); font-size: 15px; line-height: 1.38; overflow-wrap: anywhere; cursor: default; }
.msg.mine .bubble { background: var(--accent-soft); border-color: var(--accent-line, var(--gold)); }
.msg[data-msg] .bubble:not(.is-deleted) { cursor: pointer; -webkit-user-select: none; user-select: none; }
.msg:not(.mine).last .bubble { border-bottom-left-radius: 5px; }
.msg.mine.last .bubble { border-bottom-right-radius: 5px; }
.bubble.is-deleted { color: var(--muted); font-size: 13.5px; }
.msg-name { font-size: 12.5px; font-weight: 800; margin-bottom: 2px; }
.msg-text a { color: var(--gold); }
.msg-time { display: block; text-align: right; margin-top: 2px; color: var(--muted); font-size: 11px; }
.msg-read.is-read { color: var(--gold); }
.msg-photo { display: block; padding: 0; border: 0; background: none; margin: 2px 0 4px; cursor: zoom-in; }
.msg-photo img { display: block; max-width: min(260px, 100%); max-height: 320px; border-radius: 10px; object-fit: cover; }
.chat-compose { position: fixed; left: 0; right: 0; bottom: calc(63px + env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: flex-end; gap: 6px; padding: 8px max(10px, calc((100vw - 640px) / 2 + 10px)); background: var(--bar); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.chat-input-wrap { flex: 1; display: grid; gap: 6px; min-width: 0; }
.chat-input-wrap textarea { resize: none; min-height: 42px; max-height: 140px; font: inherit; font-size: 16px; border-radius: 20px; padding: 10px 14px; }
.chat-photo-preview:empty { display: none; }
.chat-photo-btn { min-height: 42px; font-size: 18px; cursor: pointer; }
.chat-send { min-height: 42px; min-width: 46px; border-radius: 50%; padding: 0; font-size: 16px; }
body.in-chat .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }

/* Чат: анимации как в Telegram — своё «вылетает» снизу справа с лёгкой пружинкой, чужое мягко всплывает слева */
@keyframes msg-send { 0% { opacity: 0; transform: translateY(28px) scale(.86); } 55% { opacity: 1; transform: translateY(-3px) scale(1.015); } 100% { transform: none; } }
@keyframes msg-in { 0% { opacity: 0; transform: translateY(14px) scale(.94); } 100% { opacity: 1; transform: none; } }
@keyframes msg-edit { 0% { box-shadow: 0 0 0 2px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes tick-pop { 0% { opacity: 0; transform: scale(.3); } 70% { transform: scale(1.3); } 100% { opacity: 1; transform: none; } }
@keyframes clock-spin { to { transform: rotate(360deg); } }
.msg.anim-send .bubble { animation: msg-send .38s cubic-bezier(.2, .8, .3, 1) both; transform-origin: 100% 100%; }
.msg.anim-in { animation: msg-in .3s ease-out both; transform-origin: 0 100%; }
.msg.anim-edit .bubble { animation: msg-edit .9s ease-out; }
.anim-tick { display: inline-block; animation: tick-pop .3s ease-out; }
.msg-clock { width: 11px; height: 11px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.msg-clock path { transform-origin: 12px 12px; animation: clock-spin 1.2s linear infinite; }
.msg-failed { color: var(--red); font-weight: 800; }
.msg-edited { font-style: italic; }
.msg.is-editing .bubble { box-shadow: 0 0 0 2px var(--gold); }
.chat-send { transition: transform .12s; }
.chat-send:active { transform: scale(.88); }
/* Режим правки: полоса над полем ввода */
.chat-compose { flex-wrap: wrap; }
.chat-edit-bar { flex-basis: 100%; display: flex; align-items: center; gap: 10px; padding: 2px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; animation: msg-in .2s ease-out; }
.chat-edit-bar[hidden] { display: none; }
.chat-edit-icon { color: var(--gold); font-size: 18px; }
.chat-edit-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; border-left: 2px solid var(--gold); padding-left: 8px; }
.chat-edit-text b { color: var(--gold); font-size: 13px; }
.chat-edit-text .muted { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .msg.anim-send .bubble, .msg.anim-in, .msg.anim-edit .bubble, .anim-tick, .chat-edit-bar { animation: none; } }
.chat-thread:has(.chat-compose.is-editing) .chat-msgs { padding-bottom: 150px; }

/* Закреплённые сообщения — полоса под шапкой чата */
.chat-pins { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 16px; border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chat-pins[hidden] { display: none; }
.chat-pins:active { background: var(--soft); }
.pin-segs { display: grid; gap: 2px; align-self: stretch; width: 3px; flex-shrink: 0; }
.pin-segs i { display: block; border-radius: 2px; background: var(--line-2); min-height: 6px; }
.pin-segs i.on { background: var(--gold); }
.pin-body { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.pin-body b { color: var(--gold); font-size: 13px; }
.pin-num { color: var(--muted); font-weight: 600; }
.pin-text { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-icon { font-size: 15px; opacity: .8; }
.msg-pin { font-size: 10px; }
@keyframes msg-jump { 0%, 35% { background: var(--accent-soft); } 100% { background: transparent; } }
.msg.anim-jump { animation: msg-jump 1.6s ease-out; border-radius: 12px; }
.msg.anim-jump .bubble { animation: msg-edit 1.6s ease-out; }
/* Кнопки «в начало» и «к последним» — справа над полем ввода */
.chat-nav { position: fixed; right: max(14px, calc((100vw - 640px) / 2 + 14px)); bottom: calc(63px + 70px + env(safe-area-inset-bottom)); z-index: 14; display: grid; gap: 8px; }
.chat-nav-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ivory); font-size: 19px; font-weight: 700; box-shadow: 0 6px 18px #0007; cursor: pointer; animation: msg-in .2s ease-out; }
.chat-nav-btn[hidden] { display: none; }
.chat-nav-btn:active { transform: scale(.92); }
@media (prefers-reduced-motion: reduce) { .msg.anim-jump, .msg.anim-jump .bubble, .chat-nav-btn { animation: none; } }
.chat-nav-btn { display: grid; place-items: center; padding: 0; }
.chat-nav-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Группы под задачи */
.ava-group { background: hsl(var(--h) 40% 30%); color: #fff; font-weight: 800; }
.chat-top-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; flex: 1; min-width: 0; }
.chat-top-btn .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pick-group { border: 1px dashed var(--line-2); margin-bottom: 4px; }
.group-form { display: grid; gap: 10px; }
.group-people { max-height: 40vh; }
.group-people .chat-pick-item input { width: 20px; height: 20px; accent-color: var(--gold); flex-shrink: 0; }
.group-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.group-info { display: grid; gap: 8px; }
.group-info-head { display: flex; align-items: center; gap: 12px; }
.group-info .chat-pick-list { max-height: 36vh; }
