/* разделы Еда, Запланированное, Интеграции живут на каркасе «Проектов»: .projects-workspace + .projects-page */
.projects-workspace.section-screen[hidden] { display: none; }
.main-panel:is(.section-active,.section-transitioning) { overflow: hidden; }
.main-panel.section-active > :not(.projects-workspace) { transform: translateX(-100%); }
.projects-workspace.section-open { pointer-events: auto; transform: translateX(0); }
.projects-workspace.section-instant { transition: none; }
.projects-workspace.section-screen { z-index: 12; }
:root[data-telegram-miniapp="true"] .projects-workspace.section-screen :is(.project-back,[data-section-close]) { display: none; }
.section-screen .section-header { flex: none; }
.projects-workspace.section-screen > .section-page { flex: 0 0 auto; }
.section-screen .project-header-actions { display: inline-flex; align-items: center; gap: 4px; }
.section-skeleton { margin-top: 4px; }
.section-skeleton i { height: 68px; }

/* общие элементы: те же размеры и цвета, что у форм и списков «Проектов» */
.section-screen :is(.integrations-content,.scheduled-content) { display: grid; gap: 15px; min-width: 0; align-content: start; overflow-wrap: anywhere; }
.section-screen :is(.integration-muted,.scheduled-muted,.food-muted) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.section-screen :is(.integrations-content,.scheduled-content,.food-page) h2 { margin: 0; font-size: 16px; font-weight: 680; letter-spacing: -.15px; line-height: 1.3; }
.section-screen :is(.integration-button,.scheduled-button,.food-button.primary) { min-height: 42px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 650; text-align: center; cursor: pointer; transition: background .18s ease,opacity .18s ease; }
.section-screen :is(.integration-button.secondary,.scheduled-button.secondary,.food-button:not(.primary)) { min-height: 42px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--hover); color: var(--text); font: inherit; font-size: 14px; font-weight: 650; text-align: center; cursor: pointer; transition: background .18s ease,opacity .18s ease; }
.section-screen :is(.integration-button.danger,.scheduled-button.danger,.food-button.danger) { border: 0; background: #ad3e46; color: #fff; }
.section-screen :is(.integration-button,.scheduled-button,.food-button):disabled { opacity: .5; cursor: default; }
.section-screen :is(.integration-button,.scheduled-button,.food-button):active:not(:disabled) { opacity: .75; }
.section-screen :is(.integration-button,.scheduled-button,.food-button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.section-screen :is(.integration-field,.scheduled-field,.food-field) { display: grid; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; min-width: 0; }
.section-screen :is(.integration-field,.scheduled-field,.food-field) :is(input:not([type="checkbox"],[type="radio"],[type="range"]),select,textarea) { width: 100%; min-width: 0; min-height: 43px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--panel); color: var(--text); font: inherit; font-size: 16px; box-sizing: border-box; }
.section-screen :is(.integration-field,.scheduled-field,.food-field) textarea { padding: 11px; line-height: 1.5; }
.section-screen :is(.integration-field,.scheduled-field,.food-field) :is(input,select,textarea):focus { border-color: var(--accent); }
.section-screen :is(.scheduled-block,.scheduled-run,.scheduled-confirm,.scheduled-schedule,.integration-news,.integration-advanced,.integration-topics) { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 13px 15px; }
.section-screen :is(.integration-check,.scheduled-choice) { color: var(--text); font-size: 14px; }
.section-screen :is(input[type="checkbox"],input[type="radio"],input[type="range"]) { accent-color: var(--accent); }
.section-screen .project-settings-list { background: var(--panel); }
.section-screen .project-onboarding { min-height: min(52vh,520px); }

.section-confirm { display: grid; gap: 12px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); animation: projectDialogFade .18s ease both; }
.section-confirm p { margin: 0; font-size: 14px; line-height: 1.5; }
.section-confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (hover: hover) and (pointer: fine) {
  .section-screen :is(.integration-button,.scheduled-button,.food-button.primary):hover:not(:disabled) { opacity: .88; }
  .section-screen :is(.integration-button.secondary,.scheduled-button.secondary,.food-button:not(.primary)):hover:not(:disabled) { background: color-mix(in srgb,var(--hover) 78%,var(--text)); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .section-screen * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* заголовок строго по центру, даже если справа две кнопки, а слева нет */
:root:not([data-telegram-miniapp="true"]) .projects-workspace .project-modal-top .modal-title:not(.project-chat-title) { position: absolute; top: 50%; left: 50%; width: max-content; max-width: calc(100% - 2 * (var(--header-n,2) * var(--section-control-size,40px) + (var(--header-n,2) - 1) * 4px + 12px)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; transform: translate(-50%,-50%); pointer-events: none; }
:root:not([data-telegram-miniapp="true"]) .projects-workspace .project-modal-top .project-title-copy { display: block; overflow: hidden; text-overflow: ellipsis; }
.projects-workspace .project-modal-top .project-header-actions { margin-left: auto; }

/* ---------- Библиотека: блок вместо чата ---------- */
.library-screen > .section-page.library-page { display: flex; flex-direction: column; gap: 16px; height: 100%; min-height: 0; width: min(1000px,100%); padding-bottom: 12px; }

.library-screen { padding-bottom: 0; }
.library-screen > .section-page.library-page { padding-bottom: 0; gap: 14px; }
/* на iPhone в PWA список доходит до самого края: высота блока не режется под «полосу» iOS, отступ только внутри прокрутки */
@media (max-width: 760px) { .projects-workspace.library-screen { top: 0; bottom: 0; height: auto; } }
.library-screen > .section-page.library-page { min-height: 0; height: 100%; }
