/* ============================================================
   app.css — слой приложения поверх peach.css
   SPA-склейка + микро-анимации + 3D-рельса дней + экран входа.
   Файл дизайнера peach.css НЕ трогаем — всё расширение тут.
   ============================================================ */

/* --- сброс ссылок: в peach.css его нет, иначе <a> синие/подчёркнутые --- */
a { color: inherit; text-decoration: none; }

/* --- SPA: показ / скрытие экранов --- */
[hidden] { display: none !important; }
/* Красим всё дерево, чтобы по краям не светил дефолтный белый.
   ВАЖНО: html не наследует CSS-переменные, которые меняются в
   body[data-theme=...] — они объявлены на body, а html стоит выше.
   Поэтому фон html задаём ЯВНО через :has() для каждой темы. */
html {
  background: #faece0;          /* peach по умолчанию */
  -webkit-tap-highlight-color: transparent;
  min-height: 100%;
}
html:has(body[data-theme="cream"]) { background: #f6f1e6; }
html:has(body[data-theme="mint"])  { background: #e7f3ec; }
html:has(body[data-theme="ph"])    { background: #000000; }

body {
  background: var(--p-bg);
  min-height: 100vh;
  min-height: 100dvh;
  /* подложка под home-indicator iPhone */
  padding-bottom: env(safe-area-inset-bottom);
}

/* iOS rubber-band на overscroll не должен показывать слой ниже */
html, body, .app-overlay { overscroll-behavior: none; }

/* оверлеи поверх контента должны сами заливать фон, а не показывать пустоту */
.app-overlay { background: var(--p-bg-flat); }

/* bottom-sheet'ы не должны заходить под home-indicator */
aside.sheet { padding-bottom: max(18px, env(safe-area-inset-bottom)); }

#app > .shell { margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
body[data-theme="ph"] { background: #000; }

/* запрет pinch-zoom + двойного-тап-зума на мобильных: сайт не должен
   «ездить» при попытках приблизить. Скролл по осям остаётся. */
html, body {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

/* ============================================================
   ИКОНКА ВКЛАДКИ «ЕЩЁ» — эмодзи (👩/👨/любой) вместо svg-иконки.
   ============================================================ */
.tabbar__emoji {
  font-size: 22px;
  line-height: 1;
  display: inline-block;
}

/* ============================================================
   INLINE-УДАЛЕНИЕ ЗАДАЧИ — крестик слева от стрелки переноса.
   Положение синхронизировано с .task__reschedule (right:8px).
   Также добавляем padding-right в title-row, чтобы qty-бейдж
   не наезжал на кнопки.
   ============================================================ */
.task__title-row {
  padding-right: 64px;  /* место для кнопок × и → внизу-справа */
}
.task__delete {
  position: absolute;
  right: 42px;          /* 8 (margin) + 26 (reschedule) + 8 (gap) */
  bottom: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(196, 80, 43, 0.10);
  color: #b14625;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  border: 1px solid rgba(196, 80, 43, 0.15);
}
.task__delete:active { transform: scale(0.85); }
.task.is-done .task__delete { display: none; }
.task--shoot  .task__delete { color: #a84020; }
.task--photo  .task__delete { color: #a84020; }
.task--custom .task__delete { color: #a84020; }
/* min-height чтобы две кнопки помещались под title-row на коротких задачах */
.task { min-height: 64px; }

/* iOS Safari автозумит при focus на input с font-size < 16px.
   Гарантируем 16px на всех вводимых полях. */
input[type="text"], input[type="time"], input[type="number"],
input[type="date"], input[type="email"], input[type="password"],
input[type="search"], textarea, select {
  font-size: 16px;
}

/* экраны-оверлеи (меню, sheets, настройки, перенос, «день закрыт») */
.app-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
}
.app-overlay > .shell { min-height: 100%; }

/* статус-бар дизайн-макета (9:41 · 5G) — артефакт превью */
.status-bar { display: none !important; }

/* ============================================================
   ЭКРАН ВХОДА
   ============================================================ */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--p-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login__card {
  width: 100%;
  max-width: 340px;
  background: var(--p-card-solid);
  border: 1px solid var(--p-card-border);
  border-radius: var(--p-r-xl);
  box-shadow: var(--p-sh-modal);
  padding: 32px 24px 26px;
  text-align: center;
}
.login__crown {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(212, 172, 79, 0.35));
}
.login__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 12px;
  color: var(--p-ink);
}
.login__sub {
  font-size: 13px;
  color: var(--p-ink-2);
  margin-top: 4px;
}
.login__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}
.login__input {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--p-divider);
  border-radius: var(--p-r-md);
  background: #fff;
  color: var(--p-ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}
.login__input:focus { border-color: var(--p-shoot); }
.login__error {
  font-size: 12.5px;
  color: #9a3a3a;
  background: #f7e0db;
  border-radius: var(--p-r-sm);
  padding: 8px 11px;
  text-align: left;
  line-height: 1.4;
}
.login__btn {
  margin-top: 4px;
  padding: 14px;
  border-radius: var(--p-r-pill);
  background: var(--p-ink);
  color: var(--p-ink-inv);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.14s ease, opacity 0.15s ease;
}
.login__btn:active { transform: scale(0.96); }
.login__btn:disabled { opacity: 0.5; }

/* ============================================================
   МИКРО-АНИМАЦИИ — ощущение приложения, а не веб-страницы.
   ============================================================ */
button, a.link-chip, a.more-tile, a.more-hero,
.task, .day-card, .slot-card, .cal__cell, .week-day,
.mood-btn, .theme-swatch, .accent-swatch, .settings-row, .menu-row,
.tabbar__item, .fab, .hero__gear, .rail-btn {
  transition: transform 0.14s cubic-bezier(.22,.61,.36,1),
              box-shadow 0.18s ease, opacity 0.18s ease,
              background-color 0.18s ease, border-color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active, a.link-chip:active, .mood-btn:active,
.settings-row:active, .menu-row:active, .cal__cell:active,
.theme-swatch:active, .accent-swatch:active {
  transform: scale(0.9);
}
a.more-tile:active, a.more-hero:active, .slot-card:active, .task:active {
  transform: scale(0.975);
}
.tabbar__item:active { transform: scale(0.88); }
.fab:active        { transform: scale(0.86) rotate(90deg); }
.hero__gear:active { transform: scale(0.84) rotate(35deg); }
.rail-btn:active   { transform: scale(0.8); }

@keyframes app-view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
#app > .shell:not([hidden]) {
  animation: app-view-in 0.3s cubic-bezier(.22,.61,.36,1);
}

@keyframes app-sheet-up   { from { transform: translateY(100%); } to { transform: none; } }
@keyframes app-sheet-down { to   { transform: translateY(100%); } }
@keyframes app-fade-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-fade-out   { to   { opacity: 0; } }

.app-overlay:not([hidden]) .sheet { animation: app-sheet-up 0.34s cubic-bezier(.22,.61,.36,1); }
.app-overlay:not([hidden]) .dim   { animation: app-fade-in 0.22s ease; }
.app-overlay.is-closing .sheet    { animation: app-sheet-down 0.2s ease forwards; }
.app-overlay.is-closing .dim      { animation: app-fade-out 0.2s ease forwards; }
.app-overlay.is-closing           { animation: app-fade-out 0.22s ease forwards; }

/* ============================================================
   ЦЕНТРИРОВАННАЯ МОДАЛКА (#ov-edit) — НЕ bottom-sheet, а по центру
   экрана. Поверх лежит на dim. Закрывается × сверху-справа.
   ============================================================ */
#ov-edit, #ov-tg-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* отменяем bottom:0 из inset:0, используем dynamic viewport height —
     при появлении iOS-клавиатуры контейнер уменьшится вместе с visualViewport,
     и flex-center сам подвинет модалку в видимую область. */
  bottom: auto;
  height: 100dvh;
}
#ov-edit .sheet.sheet--center, #ov-tg-link .sheet.sheet--center {
  position: relative;
  inset: auto;
  margin: 0;
  width: 100%;
  max-width: 420px;
  /* dvh учитывает iOS-клавиатуру: при её появлении модалка уменьшается
     вместе с visualViewport, и кнопка «сохранить» остаётся видимой. */
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border-radius: 22px;
  padding: 22px 18px 18px;
}
#ov-edit:not([hidden]) .sheet.sheet--center,
#ov-tg-link:not([hidden]) .sheet.sheet--center {
  animation: app-modal-in 0.22s cubic-bezier(.22,.61,.36,1);
}
#ov-edit.is-closing .sheet.sheet--center,
#ov-tg-link.is-closing .sheet.sheet--center {
  animation: app-modal-out 0.18s ease forwards;
}
@keyframes app-modal-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: none; }
}
@keyframes app-modal-out {
  to { opacity: 0; transform: scale(0.94); }
}
/* у центрированной модалки grip не нужен — у неё нет swipe-to-close */
#ov-edit .sheet__grip, #ov-tg-link .sheet__grip { display: none; }

/* ============================================================
   КРЕСТИК ЗАКРЫТИЯ (×) В ПРАВОМ ВЕРХНЕМ УГЛУ ЛЮБОГО SHEET
   ============================================================ */
.sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--p-card-solid);
  border: 1px solid var(--p-divider);
  font-size: 20px;
  line-height: 1;
  color: var(--p-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
}
.sheet__close:active { transform: scale(0.88); }
.sheet { position: relative; }

/* ============================================================
   ВЕРСТКА «СКОЛЬКО» В РЕДАКТОРЕ — qty слева, ± справа, между ними
   гибкий разделитель, чтобы кнопки не наезжали на число.
   ============================================================ */
.qty-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.qty-row__num {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.qty-row__unit {
  font-size: 13px;
  color: var(--p-ink-2);
  font-weight: 500;
}
.qty-row__steppers {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ============================================================
   КОЛЕСО ВЫБОРА QTY (#ov-qty) — вертикальная лента со scroll-snap
   ============================================================ */
.qty-wheel-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 4px 0;
}
.qty-wheel-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--p-card-solid);
  border: 1.5px solid var(--p-divider);
  font-size: 22px;
  font-weight: 500;
  color: var(--p-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.qty-wheel-btn:active { transform: scale(0.88); }
.qty-wheel {
  position: relative;
  width: 140px;
  height: 180px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* центрирующий gradient-mask: затемнение по краям */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 35%, #000 65%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 35%, #000 65%, transparent 100%);
  padding: 70px 0;     /* 70 = (height - itemHeight) / 2 */
}
.qty-wheel::-webkit-scrollbar { display: none; }
.qty-wheel__item {
  height: 40px;
  scroll-snap-align: center;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  opacity: 0.32;
  transform: scale(0.78);
  transition: opacity 0.14s, transform 0.14s;
  font-weight: 500;
  color: var(--p-ink);
}
.qty-wheel__item.is-active {
  opacity: 1;
  transform: scale(1.1);
  font-weight: 700;
}
.qty-wheel__n { font-size: 28px; letter-spacing: -0.02em; }
.qty-wheel__unit { font-size: 12px; color: var(--p-ink-2); font-weight: 500; }

/* линии-индикатор центра */
.qty-wheel-block::before, .qty-wheel-block::after {
  content: '';
  display: none;
}
/* длинное название задачи в шапке qty-пикера — обрезаем в одну строку */
#ov-qty [data-qty-title] {
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   ПРЕВЬЮ ЗАДАЧ В ШИТ ПЕРЕНОСА — read-only список под календарём
   ============================================================ */
.rs-day-preview {
  margin-top: 16px;
  padding: 12px 4px 0;
  border-top: 1px solid var(--p-divider);
}
.rs-day-preview__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 8px;
}
.rs-day-preview__date {
  font-weight: 600;
  font-size: 13px;
  color: var(--p-ink);
}
.rs-day-preview__count {
  font-size: 11px;
  color: var(--p-ink-2);
  font-family: var(--p-serif);
  font-style: italic;
}
.rs-day-preview__empty {
  padding: 14px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--p-ink-2);
  font-family: var(--p-serif);
  font-style: italic;
}
.rs-day-preview__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rs-day-preview__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--p-card-solid);
  border: 1px solid var(--p-divider);
  font-size: 13px;
  min-width: 0;
}
.rs-day-preview__item--shoot  { border-left: 3px solid var(--p-shoot); }
.rs-day-preview__item--photo  { border-left: 3px solid var(--p-photo); }
.rs-day-preview__item--custom { border-left: 3px solid var(--p-custom); }
.rs-day-preview__item--sext   { border-left: 3px solid var(--p-sext); }
.rs-day-preview__item--rest   { border-left: 3px solid var(--p-rest); }
.rs-day-preview__emoji { font-size: 15px; flex-shrink: 0; }
.rs-day-preview__title {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-day-preview__time {
  font-size: 11px;
  color: var(--p-ink-2);
  font-family: var(--p-serif);
  font-style: italic;
  flex-shrink: 0;
}
.rs-day-preview__qty {
  font-size: 11px;
  color: var(--p-ink-2);
  flex-shrink: 0;
}

@keyframes app-pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(-10px); }
  to   { opacity: 1; transform: none; }
}
.app-overlay:not([hidden]) .menu-pop {
  animation: app-pop-in 0.24s cubic-bezier(.22,.61,.36,1);
  transform-origin: top left;
}
.app-overlay.is-closing .menu-pop { animation: app-fade-out 0.15s ease forwards; }

#ov-settings:not([hidden]), #ov-reschedule:not([hidden]), #ov-done:not([hidden]),
#ov-shopping:not([hidden]), #ov-meds:not([hidden]),
#ov-workouts:not([hidden]), #ov-ideas:not([hidden]) {
  animation: app-fade-in 0.26s ease;
}

@keyframes app-check-pop {
  0%   { transform: scale(0.4); }
  55%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.task__check.is-checked::after {
  animation: app-check-pop 0.34s cubic-bezier(.34,1.56,.64,1);
}

@keyframes app-drop-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.8); }
  to   { opacity: 1; transform: none; }
}
.hero__crown-glyph {
  animation: app-drop-in 0.55s 0.08s backwards cubic-bezier(.34,1.56,.64,1);
}

.mood-btn.is-active, .mood-picker__item.is-active {
  animation: app-check-pop 0.3s cubic-bezier(.34,1.56,.64,1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   3D-РЕЛЬСА ДНЕЙ НЕДЕЛИ (экран «Сегодня»)
   Трансформы каждому дню навешивает JS на скролле.
   ============================================================ */
.week-strip {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 0 !important;
  padding: 20px 0 !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  perspective: 720px;
  scrollbar-width: none;
}
.week-strip::-webkit-scrollbar { display: none; }
.week-strip::before,
.week-strip::after {
  content: '';
  flex: 0 0 calc(50% - 39px);
}
.week-strip .week-day {
  flex: 0 0 78px;
  margin: 0 1px;
  scroll-snap-align: center;
  transform-style: preserve-3d;
  will-change: transform, opacity;
}
.week-strip .week-day.is-active {
  background: var(--p-card-solid);
  border: 1.5px solid var(--p-ink);
  box-shadow: 0 14px 30px -12px rgba(42,31,26,.4);
}
/* маркер реального «сегодня» на рельсе (на случай если выбран другой день) */
.week-strip .week-day.is-today:not(.is-active) {
  border: 1.5px solid var(--p-shoot);
}
.week-strip .week-day.is-today:not(.is-active) .week-day__num {
  color: var(--p-shoot);
}

/* разделитель недель в рельсе — символ | по центру, полупрозрачный.
   Виден во всех темах, цвет берётся из --p-ink (адаптируется автоматически). */
.week-strip__divider {
  flex: 0 0 auto;
  align-self: center;
  font-size: 32px;
  font-weight: 200;
  line-height: 1;
  color: var(--p-ink);
  opacity: 0.28;
  padding: 0 6px;
  scroll-snap-align: none;
  pointer-events: none;
  user-select: none;
}
body[data-theme="ph"] .week-strip__divider { color: #ff9000; opacity: 0.4; }
body[data-theme="mint"] .week-strip__divider { opacity: 0.35; }
body[data-theme="cream"] .week-strip__divider { opacity: 0.32; }

/* ============================================================
   SMART-ПЕРЕНОС: быстрые чипы и инлайн-date
   ============================================================ */
.rs-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 4px;
}
.rs-quick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 14px 14px;
  border-radius: 14px;
  background: var(--p-card-solid);
  border: 1.5px solid var(--p-divider);
  text-align: left;
  cursor: pointer;
}
.rs-quick:active { transform: scale(0.97); }
.rs-quick__label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--p-ink);
}
.rs-quick__hint {
  font-size: 11.5px;
  color: var(--p-ink-2);
  font-family: var(--p-serif);
  font-style: italic;
}
/* ============================================================
   МИНИ-КАЛЕНДАРЬ ПЕРЕНОСА — компактный read-only календарь
   в bottom-sheet'е переноса. Показывает существующие задачи как
   точки нагрузки, кликом выбирается дата переноса.
   ============================================================ */
.rs-cal {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--p-divider);
  border-radius: 16px;
  padding: 10px 8px 12px;
}
.rs-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 8px;
}
.rs-cal__title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--p-ink);
}
.rs-cal__nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--p-card-solid);
  border: 1px solid var(--p-divider);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--p-ink);
}
.rs-cal__nav-btn:active { transform: scale(0.88); }
.rs-cal__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0 2px 6px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--p-ink-2);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rs-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.rs-cal__cell {
  aspect-ratio: 1;
  border-radius: 9px;
  background: var(--p-card-solid);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--p-ink);
  cursor: pointer;
}
.rs-cal__cell--empty {
  background: transparent;
  pointer-events: none;
}
.rs-cal__cell--today {
  background: var(--p-ink);
  color: var(--p-ink-inv);
}
.rs-cal__cell--past {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
}
.rs-cal__cell--source {
  opacity: 0.5;
  pointer-events: none;
  background: rgba(196, 80, 43, 0.15);
}
.rs-cal__cell.is-active {
  border: 2px solid var(--p-ink);
  background: var(--p-card-solid);
  color: var(--p-ink);
}
.rs-cal__cell--today.is-active {
  outline: 2px solid var(--p-shoot);
  outline-offset: 1px;
  /* активный = today: оставляем чёрный фон и добавляем персиковую обводку */
  background: var(--p-ink);
  color: var(--p-ink-inv);
}
.rs-cal__cell:active:not(.rs-cal__cell--past):not(.rs-cal__cell--source) {
  transform: scale(0.94);
}
.rs-cal__dots {
  display: flex;
  gap: 2px;
}
.rs-cal__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* ============================================================
   КАЛЕНДАРЬ «МЕСЯЦ» — обводка выбранного дня (кликнутый)
   Чёрная рамка вокруг ячейки, на которую тапнули.
   ============================================================ */
.cal__cell.is-active {
  border: 2px solid var(--p-ink) !important;
  box-shadow: 0 0 0 1px var(--p-bg-flat) inset;
}
.cal__cell.cal__cell--today.is-active {
  outline: 2px solid var(--p-shoot);
  outline-offset: 1px;
}

/* ============================================================
   SWIPE-DOWN-TO-CLOSE: визуальная подсказка на грифе
   (touch-handlers в main.js — onSheetSwipe*)
   ============================================================ */
.sheet__grip {
  cursor: grab;
  touch-action: none;        /* пусть touchmove не скроллит страницу */
  padding: 14px 0 8px;       /* расширяем зону хвата для пальца */
  margin-top: -10px;
}
.sheet__grip:active { cursor: grabbing; }

/* ============================================================
   ТАЧ-ТАРГЕТЫ В РЕДАКТОРЕ ЗАДАЧИ — увеличены для пальца.
   Дизайнерские размеры были 18-26px, на телефоне попасть тяжело.
   ============================================================ */
#ov-edit .color-swatch {
  width: 32px;
  height: 32px;
  min-width: 32px;
}
#ov-edit .color-swatch.is-active {
  width: 38px;
  height: 38px;
  min-width: 38px;
}
#ov-edit .color-row {
  gap: 10px;
  flex-wrap: wrap;
}
#ov-edit .stepper__btn {
  width: 38px;
  height: 38px;
  font-size: 20px;
  font-weight: 500;
}
#ov-edit .stepper__btn:active {
  transform: scale(0.88);
  background: var(--p-divider);
}
#ov-edit .seg__btn {
  padding: 9px 14px;
  min-height: 38px;
}
#ov-edit .sheet__delete {
  padding: 8px 12px;
  min-height: 34px;
}
#ov-edit .btn {
  min-height: 48px;
  font-size: 15px;
}
#ov-edit .btn:active { transform: scale(0.97); }

/* нижний ряд кнопок редактора: слева «удалить», справа «сохранить».
   Когда удалить скрыт (mode=add), сохранить занимает всю ширину сам. */
.sheet__actions--split {
  display: flex !important;
  gap: 10px;
  flex-wrap: nowrap;
}
.sheet__actions--split .btn { flex: 1; min-width: 0; }
.btn--danger {
  background: rgba(196, 80, 43, 0.12);
  color: #b14625;
  border: 1px solid rgba(196, 80, 43, 0.25);
  font-weight: 600;
}
.btn--danger:active { transform: scale(0.96); background: rgba(196, 80, 43, 0.18); }
body[data-theme="ph"] .btn--danger {
  background: #2a1818;
  color: #ff9090;
  border-color: #4a2828;
}
#ov-edit .sheet__emoji-box {
  width: 52px;
  height: 52px;
  min-width: 52px;
}

/* ============================================================
   КЛАВИАТУРА: сдвигаем ТОЛЬКО bottom-sheet'ы (.sheet без .sheet--center)
   вверх на высоту клавиатуры, чтобы их нижние кнопки оставались видимыми.
   Центрированные модалки (#ov-edit, #ov-tg-link) трогать НЕ нужно —
   у них height:100dvh + flex-center, который сам уезжает в visualViewport.
   Двойной сдвиг (translateY + flex) выкидывал модалку за верх экрана.
   ============================================================ */
.app-overlay:not([hidden]) .sheet:not(.sheet--center) {
  transform: translateY(calc(-1 * var(--kb-shift, 0px)));
  transition: transform 0.2s ease;
}

/* ============================================================
   ТЕМЫ — крем / мята / сумерки (персик = базовый :root в peach.css)
   Переопределяем только поверхности и текст; акценты задаются
   отдельно через --p-shoot (выбор акцента в настройках).
   ============================================================ */
body[data-theme="cream"] {
  --p-bg:          linear-gradient(180deg, #f6f1e6 0%, #ebe3d2 100%);
  --p-bg-flat:     #f6f1e6;
  --p-card:        rgba(255, 255, 255, 0.66);
  --p-card-solid:  #fffdf8;
  --p-card-border: rgba(255, 255, 255, 0.9);
}
body[data-theme="mint"] {
  --p-bg:          linear-gradient(180deg, #e7f3ec 0%, #d3e9dd 100%);
  --p-bg-flat:     #e7f3ec;
  --p-card:        rgba(255, 255, 255, 0.66);
  --p-card-solid:  #ffffff;
  --p-card-border: rgba(255, 255, 255, 0.9);
  /* На светло-мятном фоне базовый ink-2 слишком блёклый — поднимаем
     контраст у вторичного текста и плейсхолдеров, чтобы они читались. */
  --p-ink-2:       #4a6a55;
  --p-ink-3:       #6a8775;
}
/* В мяте «прошедшие» дни и плейсхолдеры — повышаем читаемость */
body[data-theme="mint"] .day-card--past,
body[data-theme="mint"] .week-day.is-past { opacity: 0.65; }
body[data-theme="mint"] .day-card__empty,
body[data-theme="mint"] .day-card__day-off { color: #4a6a55; }

/* ============================================================
   ТЕМА «ПХ» — фирменный чёрно-жёлтый. Жёлтый #ff9000 — точный
   акцент PornHub. Темнота — насыщенный чёрный.
   Все hardcoded white/cream поверхности из peach.css перекрыты.
   ============================================================ */
body[data-theme="ph"] {
  --p-bg:          linear-gradient(180deg, #0a0a0a 0%, #000000 100%);
  --p-bg-flat:     #000000;
  --p-card:        rgba(255, 255, 255, 0.045);
  --p-card-solid:  #1a1a1a;
  --p-card-border: #2a2a2a;
  --p-ink:         #ffffff;
  --p-ink-2:       #c4c4c4;
  --p-ink-3:       #888888;
  --p-ink-inv:     #000000;
  --p-divider:     #2a2a2a;
  --p-shoot:       #ff9000;
}
/* перекрытие peach.css: cards и task-tints, которые там жёстко
   заданы под светлую тему — иначе светлые блоки на чёрном фоне. */
body[data-theme="ph"] .day-card,
body[data-theme="ph"] .day-card--glass {
  background: #1a1a1a !important;
  border: 1px solid #2a2a2a !important;
  color: #ffffff;
}
body[data-theme="ph"] .day-card__date { color: #ff9000; }
body[data-theme="ph"] .day-card__name { color: #ffffff; }
body[data-theme="ph"] .day-card__empty,
body[data-theme="ph"] .day-card__day-off { color: #888; }

body[data-theme="ph"] .task {
  background: #232323 !important;
  color: #ffffff;
  border-left-color: #ff9000;
}
body[data-theme="ph"] .task--shoot  { background: #2a2010 !important; border-left-color: #ff9000; }
body[data-theme="ph"] .task--photo  { background: #1a2435 !important; border-left-color: #4a8be8; }
body[data-theme="ph"] .task--custom { background: #2a1818 !important; border-left-color: #e85555; }
body[data-theme="ph"] .task--sext   { background: #251a2e !important; border-left-color: #b06fd6; }
body[data-theme="ph"] .task--rest   { background: #182a1c !important; border-left-color: #4a9a5e; }
body[data-theme="ph"] .task__time,
body[data-theme="ph"] .task__desc { color: #b5b5b5; }
body[data-theme="ph"] .task.is-done .task__title-text { color: #777; text-decoration-color: #777; }
body[data-theme="ph"] .task__check { background: #2a2a2a; border-color: #444; }
body[data-theme="ph"] .task__check.is-checked { background: #ff9000; border-color: #ff9000; }
body[data-theme="ph"] .task__reschedule { background: #2a2a2a; color: #ff9000; }
body[data-theme="ph"] .task__delete { background: #2a1818; color: #ff9090; border-color: #4a2828; }
body[data-theme="ph"] .task__qty { background: #ff9000; color: #000; }
body[data-theme="ph"] .add-task { color: #ff9000; border-color: #ff9000; }

body[data-theme="ph"] .week-day { background: #1a1a1a; color: #fff; border-color: transparent; }
body[data-theme="ph"] .week-day.is-active { background: #1a1a1a; border-color: #ff9000; box-shadow: 0 14px 30px -12px rgba(255,144,0,.35); }
body[data-theme="ph"] .week-day.is-today:not(.is-active) { border-color: #ff9000; }
body[data-theme="ph"] .week-day.is-today:not(.is-active) .week-day__num { color: #ff9000; }
body[data-theme="ph"] .week-day__label { color: #c4c4c4; }

body[data-theme="ph"] .cal__cell { background: #1a1a1a; color: #fff; border: 1px solid #2a2a2a; }
body[data-theme="ph"] .cal__cell--today { background: #ff9000; color: #000; border-color: #ff9000; }
body[data-theme="ph"] .cal__cell.is-active { border: 2px solid #ff9000 !important; }

body[data-theme="ph"] .sheet,
body[data-theme="ph"] .menu-pop,
body[data-theme="ph"] .login__card {
  background: #1a1a1a !important;
  color: #fff;
  border: 1px solid #2a2a2a;
}
body[data-theme="ph"] .sheet__close,
body[data-theme="ph"] .rs-cal__nav-btn,
body[data-theme="ph"] .stepper__btn,
body[data-theme="ph"] .qty-wheel-btn,
body[data-theme="ph"] .rail-btn,
body[data-theme="ph"] .hero__gear {
  background: #2a2a2a !important;
  color: #fff;
  border-color: #3a3a3a;
}
body[data-theme="ph"] .seg { background: #2a2a2a; }
body[data-theme="ph"] .seg__btn { color: #c4c4c4; }
body[data-theme="ph"] .seg__btn.is-active { background: #ff9000 !important; color: #000 !important; box-shadow: 0 2px 8px rgba(255,144,0,.3); }
body[data-theme="ph"] .prop__input { background: #1a1a1a; color: #fff; border-color: #2a2a2a; }
body[data-theme="ph"] .sheet__title-input,
body[data-theme="ph"] .sheet__sub-input,
body[data-theme="ph"] .login__input { background: #1a1a1a; color: #fff; border-color: #2a2a2a; }
body[data-theme="ph"] .sheet__emoji-box { background: #2a2a2a; }
body[data-theme="ph"] .sheet__delete { background: #2a1818; color: #ff9090; }
body[data-theme="ph"] .btn--secondary { background: #2a2a2a; color: #fff; }
body[data-theme="ph"] .btn--primary { background: #ff9000; color: #000; }

body[data-theme="ph"] .tabbar { background: #1a1a1a; border: 1px solid #2a2a2a; }
body[data-theme="ph"] .tabbar__item { color: #888; }
body[data-theme="ph"] .tabbar__item.is-active { background: #ff9000; color: #000; }

body[data-theme="ph"] .hero__title { background: linear-gradient(135deg, #ff9000 0%, #ffb84a 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
body[data-theme="ph"] .hero__quote-text { color: #c4c4c4; }
body[data-theme="ph"] .hero__quote-bar { background: #ff9000; }
body[data-theme="ph"] .pill { background: #1a1a1a; color: #fff; border: 1px solid #2a2a2a; }
body[data-theme="ph"] .pill--icon { background: #2a2a2a; }
body[data-theme="ph"] .login__btn { background: #ff9000; color: #000; }
body[data-theme="ph"] .login__btn:disabled { background: #4a3700; }

body[data-theme="ph"] .mood-btn,
body[data-theme="ph"] .mood-picker__item { background: #2a2a2a; border-color: #3a3a3a; }
body[data-theme="ph"] .mood-btn.is-active,
body[data-theme="ph"] .mood-picker__item.is-active { background: #ff9000; }

body[data-theme="ph"] .rs-quick { background: #1a1a1a; border-color: #2a2a2a; color: #fff; }
body[data-theme="ph"] .rs-quick__label { color: #fff; }
body[data-theme="ph"] .rs-quick__hint { color: #ff9000; }
body[data-theme="ph"] .rs-cal { background: rgba(255,255,255,0.03); border-color: #2a2a2a; }
body[data-theme="ph"] .rs-cal__title { color: #fff; }
body[data-theme="ph"] .rs-cal__cell { background: #1a1a1a; color: #fff; }
body[data-theme="ph"] .rs-cal__cell--today { background: #ff9000; color: #000; }
body[data-theme="ph"] .rs-cal__cell.is-active { border: 2px solid #ff9000; }
body[data-theme="ph"] .rs-cal__weekdays { color: #888; }
body[data-theme="ph"] .rs-day-preview__item { background: #1a1a1a; border-color: #2a2a2a; color: #fff; }
body[data-theme="ph"] .rs-day-preview__date { color: #fff; }
body[data-theme="ph"] .rs-day-preview__empty { color: #888; }

body[data-theme="ph"] .qty-wheel-block { color: #fff; }
body[data-theme="ph"] .qty-wheel__item { color: #fff; }
body[data-theme="ph"] .qty-wheel__unit { color: #ff9000; }

body[data-theme="ph"] .menu-row { color: #fff; }
body[data-theme="ph"] .menu-row:active { background: #2a2a2a; }
body[data-theme="ph"] .menu-row__sub { color: #888; }

body[data-theme="ph"] .settings-row { background: #1a1a1a; color: #fff; }
body[data-theme="ph"] .settings-group__card { background: #1a1a1a; border-color: #2a2a2a; }
body[data-theme="ph"] .settings-divider { background: #2a2a2a; }
body[data-theme="ph"] .more-tile { background: #1a1a1a; border: 1px solid #2a2a2a; color: #fff; }
body[data-theme="ph"] .more-hero { background: #1a1a1a; border: 1px solid #ff9000; color: #fff; }
body[data-theme="ph"] .more-hero__title em { color: #ff9000; }
body[data-theme="ph"] .progress-section { background: #1a1a1a; border-color: #2a2a2a; }
body[data-theme="ph"] .progress-section__streak-num { color: #ff9000; }
body[data-theme="ph"] .counter-row__num--shoot,
body[data-theme="ph"] .counter-row__num--custom { color: #ff9000; }
/* в пх-теме светлые pastel-tints плашек прогресса делают текст невидимым —
   переопределяем фон на тёплый тёмный, текст ярко-белый */
body[data-theme="ph"] .counter-row { background: #1f1a14 !important; border: 1px solid #2a2a2a; }
body[data-theme="ph"] .counter-row--shoot  { background: #2a2010 !important; }
body[data-theme="ph"] .counter-row--custom { background: #2a1c14 !important; }
body[data-theme="ph"] .counter-row__name   { color: #ffffff; }
body[data-theme="ph"] .counter-row__target { color: #c4c4c4; }
body[data-theme="ph"] .counter-row__bar    { background: rgba(255,255,255,0.08); }
body[data-theme="ph"] .counter-row__bar-fill--shoot,
body[data-theme="ph"] .counter-row__bar-fill--custom { background: #ff9000; }
body[data-theme="ph"] .progress-section__streak-suffix { color: #888; }
body[data-theme="ph"] .progress-section__row { color: #fff; }

/* Свотч темы «пх» в настройках */
.theme-swatch--ph {
  background: #000 !important;
  position: relative;
}
.theme-swatch--ph::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff9000;
}

