/* Штаб на телефоне: каркас (нижнее меню вместо бокового), Пульт, «Ещё», быстрая задача, вход, шапка проекта.
   Строки задач, карточка, виды и календарь — в mobile-tasks.css. Макеты — «Телефон …» (canvas/project).
   Порог 820px: уже на нём боковое меню съедает треть экрана. */
:root {
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* сколько места снизу занимает нижнее меню — от этого отступают контент и закреплённые панели */
  --bottom-space: calc(var(--tabbar-h) + var(--safe-b));
}

/* ---------- то, что нужно и на широком экране ---------- */
.tabbar, .only-phone { display: none; }
.project-top { display: flex; flex-direction: column; gap: 18px; }
.tfilters-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* «Ещё»: плитки разделов, проекты, выход */
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.more-tile {
  min-height: 96px; padding: 12px; background: var(--card); border-radius: 20px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px; font-weight: 600; line-height: 1.2;
}
.more-tile svg { color: var(--muted); }
.more-projects { display: flex; flex-wrap: wrap; gap: 6px; }
.more-project {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  background: var(--card); border-radius: 22px; font-weight: 500;
}
.more-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--card); border-radius: 20px; }
.more-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more-who span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

/* быстрая задача на весь экран */
.qpage { max-width: 640px; display: flex; flex-direction: column; gap: 14px; }
.qpage-input {
  width: 100%; min-height: 140px; padding: 14px 16px; border: 1px solid #C9CEF7; border-radius: 24px;
  background: #F3F5FF; color: var(--ink); font-size: 18px; line-height: 1.45; resize: vertical;
}
.qpage-input:focus { outline: 2px solid var(--link); outline-offset: 1px; }
.qpage-says { padding: 12px 16px; background: var(--card); border-radius: 18px; color: var(--muted); line-height: 1.45; }
.qpage-says:empty::before { content: "Понял так: …"; }
.qpage-go { height: 52px; border-radius: 26px; justify-content: center; font-size: 16px; }
.qpage .link-btn { display: inline-flex; align-items: center; font-size: 15px; }
.qpage-note { margin: 0; text-align: center; color: var(--muted-2); font-size: 13px; }

@media (max-width: 820px) {
  .only-phone { display: revert; }
  .only-desk { display: none !important; }
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; }
  /* iOS увеличивает страницу при фокусе на поле с шрифтом меньше 16px */
  input, select, textarea, .field { font-size: 16px; }

  /* ---------- каркас: боковое меню прячем, снизу — своё ---------- */
  .sidebar { display: none; }
  .main, .main--project, .main--today {
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(var(--bottom-space) + 24px);
    gap: 12px;
  }
  .tabbar {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    height: var(--bottom-space); padding: 0 6px var(--safe-b);
    display: flex; align-items: stretch; background: var(--card); border-top: 1px solid #E6E8EE;
  }
  .tab-item, .tab-mic { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
  .tab-item { flex-direction: column; gap: 3px; color: #7A7D86; font-size: 11px; font-weight: 500; }
  .tab-item.is-active { color: var(--ink); font-weight: 700; }
  .tab-mic-in {
    width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; background: var(--ink); color: var(--accent);
    display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(18, 19, 23, 0.35);
  }
  .tab-mic.is-active .tab-mic-in { outline: 3px solid var(--accent); outline-offset: 2px; }

  /* касание не меньше 44px */
  .btn, .btn--square, .fbtn, .vbtn, .nbtn, .seg-item, .layer, .dpill, .ppill, .status-btn, .reg-chip { min-height: 44px; }
  .nbtn { min-width: 44px; }
  .link-btn { min-height: 44px; padding: 0 8px; }
  .h1, h1.pnav-title { font-size: 24px; }
  .h2 { font-size: 19px; }

  /* горизонтальные полосы фильтров: листаются пальцем, страница вбок не едет */
  .ppills, .dpills, .tfilters-btns, .layers, .status-row, .tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px;
  }
  .ppills::-webkit-scrollbar, .dpills::-webkit-scrollbar, .tfilters-btns::-webkit-scrollbar,
  .layers::-webkit-scrollbar, .status-row::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .ppill, .dpill, .fbtn, .layer, .status-btn { flex: none; white-space: nowrap; }

  /* ---------- Пульт: цель в одну строку, плитки по две ---------- */
  .goal { padding: 14px 16px; border-radius: 20px; gap: 10px; }
  .goal-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .goal-track-wrap, .goal-col--pace, .goal-col--title .goal-note { display: none; }
  .goal-col--title { min-width: 0; flex-direction: row; align-items: baseline; gap: 8px; }
  .goal-sum { font-size: 15px; }
  .goal-timer { align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .goal-part { flex-direction: row; align-items: baseline; gap: 3px; font-size: 12px; }
  .goal-digit { min-width: 0; padding: 0; background: none; font-size: 18px; }
  .goal-digit--days { min-width: 0; font-family: var(--font-display); font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; border-radius: 20px; gap: 10px; }
  .tile-head { flex-wrap: wrap; gap: 4px; min-height: 44px; align-content: flex-start; }
  .tile-name { font-family: var(--font); font-size: 14px; }
  .tile-chip { padding: 0; background: none !important; font-size: 11px; opacity: 0.85; }
  .tile-stat b { font-size: 28px; }
  .tile-next, .tile-links { display: none; }
  .today-tile { padding: 14px; border-radius: 20px; }
  .section-head { padding: 4px 0 0; }

  /* ---------- шапка проекта — цветная полоса с вкладками ---------- */
  .project-top {
    margin: calc(-16px - env(safe-area-inset-top, 0px)) -16px 0;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 0; gap: 10px;
    background: var(--badge); color: color-mix(in srgb, var(--badge) 18%, #000000);
  }
  .project-top--dark { color: #FFFFFF; }
  .project-badge { display: none; }
  .project-sub { color: inherit; opacity: 0.85; }
  .project-head .btn { background: rgba(255, 255, 255, 0.85); border: 0; color: var(--ink); }
  .project-top .tabs { border-bottom: 0; }
  .project-top .tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; margin-right: 14px; color: inherit; opacity: 0.8; }
  .project-top .tab.is-active { opacity: 1; font-weight: 700; border-bottom-color: currentColor; }

  /* ---------- вход и смена пароля ---------- */
  .auth { align-items: flex-start; padding: calc(40px + env(safe-area-inset-top, 0px)) 16px 24px; }
  .auth-card { padding: 24px 20px; gap: 16px; }
  .auth .field { height: 50px; border-radius: 12px; }
  .auth .btn--accent { height: 52px; justify-content: center; font-size: 16px; border-radius: 26px; }

  /* «Ещё» — сетка 3 в ряд */
  .more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .more-tile { aspect-ratio: 1; min-height: 0; font-size: 14px; }
  .more-foot .btn { flex: none; }
}
