/* ===========================================================================
   РАЗМЕТКА И КОМПОНЕНТЫ
   Цвета берутся из theme.css — здесь только формы, отступы и анимации.
   =========================================================================== */

/* --- Каркас --------------------------------------------------------------- */

.phone {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: 0 var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Обёртка экрана: не мешает раскладке, но собирает обработчики кликов. */
.view {
  display: contents;
}

/* --- Шапка ---------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  padding: calc(16px + env(safe-area-inset-top)) var(--space-6) var(--space-6);
  background: var(--header-bg);
  backdrop-filter: blur(36px);
  -webkit-backdrop-filter: blur(36px);
}

.topbar__date {
  display: block;
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
  color: var(--text-soft);
}

.topbar__greeting {
  font-size: 25px;
  font-weight: 800;
  line-height: 29px;
  letter-spacing: -0.5px;
  margin-top: 8px;
}

.topbar--loading .topbar__greeting { margin-top: 0; }

.topbar__hello { min-width: 0; overflow-wrap: anywhere; }

.topbar__actions {
  display: flex;
  gap: var(--space-2);
}

.topbar .icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  line-height: 18px;
}

.topbar .icon-btn--help {
  font-size: 17px;
  line-height: 15px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 18px;
  font-weight: 700;
  transition: transform 0.16s ease, background 0.16s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--surface-2);
}

/* --- Главная карточка «сводка» ------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(255, 255, 255, 0.28), transparent 58%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 18px 40px -18px var(--accent);
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.hero__eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.hero__title {
  font-size: 21px;
  line-height: 23px;
  font-weight: 800;
  max-width: 30ch;
}

.hero__sub {
  margin-top: 6px;
  font-size: 14px;
  line-height: 18px;
  opacity: 0.9;
  max-width: 34ch;
}

.hero__stats {
  position: relative;
  z-index: 2;
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.hero-stat {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
  transition: background 0.16s ease;
}

.hero-stat:active {
  background: rgba(255, 255, 255, 0.24);
}

.hero-stat__value {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  line-height: 23px;
}

.hero-stat__label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  line-height: 16px;
  opacity: 0.88;
}

/* --- Секции --------------------------------------------------------------- */

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.section__head {
  display: flex;
  align-items: center;
  min-height: 32px;
  justify-content: space-between;
  gap: var(--space-2);
  padding-inline: 4px 1px;
}

.section__title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section__action {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px;
  border-radius: var(--radius-pill);
}

.section__action:active {
  background: var(--accent-soft);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* --- Дела ----------------------------------------------------------------- */

.event {
  display: grid;
  grid-template-columns: 32px 64px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  text-align: left;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, opacity 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.event:active {
  transform: scale(0.985);
}

.event__check {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 9px;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: transparent;
  background: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  flex: none;
}

.event__check svg {
  width: 16px;
  height: 16px;
}

.event--done {
  opacity: 0.62;
}

.event--done .event__check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.event--done .event__title {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.event__time {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.event__time--allday {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.2;
}

.event__main {
  min-width: 0;
}

.event__title {
  display: block;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.event__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 3px;
  min-height: 20px;
  font-size: 13px;
  line-height: 16px;
  color: var(--text-muted);
  min-width: 0;
}

.event__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--text-soft);
}

.tag-dima .event__dot { background: var(--tag-dima); }
.tag-katya .event__dot { background: var(--tag-katya); }
.tag-family .event__dot { background: var(--tag-family); }

.event--done .event__dot { background: var(--success); }

.event__bell {
  color: var(--accent);
  flex: none;
}

/* --- Дни в календаре ------------------------------------------------------- */

.calendar {
  display: grid;
  gap: var(--space-6);
}

.day {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day__head {
  position: sticky;
  top: calc(93px + env(safe-area-inset-top));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 33px;
  padding: 5px 4px;
  background: linear-gradient(var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

[data-theme="dark"] .day__head {
  background: linear-gradient(#141312 46.15%, rgba(20, 19, 18, 0.5) 73.56%, transparent);
}

.day__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 23px;
  letter-spacing: -0.34px;
}

.day__title em {
  font-style: normal;
  color: var(--accent);
}

.day__count {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-soft);
}

/* --- Переключатель периода ------------------------------------------------- */

.segmented {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-2);
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.segmented__btn {
  position: relative;
  z-index: 1;
  padding: 9px 6px;
  border-radius: var(--radius-pill);
  min-height: 36px;
  font-size: 14px;
  line-height: 18px;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.18s ease;
  white-space: nowrap;
}

.segmented__btn.is-active {
  color: var(--text);
}

.segmented__indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), width 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

/* --- Фильтры по людям ------------------------------------------------------ */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-width: 50px;
  min-height: 33px;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 400;
  line-height: 17px;
  color: var(--text-muted);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.chip:active { transform: scale(0.96); }

.chip.is-active {
  background: var(--text);
  color: var(--bg);
}

.chip[data-tag="dima"] { min-width: 84px; }
.chip[data-tag="katya"] { min-width: 77px; }
.chip[data-tag="family"] { min-width: 89px; }

/* --- Покупки -------------------------------------------------------------- */

.shop-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.shop-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease;
}

.shop-card:active { transform: scale(0.985); }

.shop-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.shop-card__name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  line-height: 23px;
  overflow-wrap: anywhere;
}

.shop-card__count {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
}

.shop-card__count--done {
  color: var(--success);
  background: var(--tag-family-soft);
}

.shop-card__preview {
  display: block;
  min-width: 0;
  margin-top: 4px;
  font-size: 14px;
  line-height: 18px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  display: block;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.shop-card .progress {
  margin-top: 12px;
}

.progress__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.progress__bar--done {
  background: linear-gradient(90deg, var(--success), #4fc59a);
}

/* --- Экран списка ---------------------------------------------------------- */

.list-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 8px 0;
}

.back-btn,
.list-head__menu {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.back-btn {
  width: 40px;
  height: 40px;
}

.list-head__menu {
  width: 42px;
  height: 42px;
  font-size: 18px;
  font-weight: 700;
  line-height: 20px;
}

.back-btn:active { transform: scale(0.94); }

.list-head__title {
  flex: 1;
  min-width: 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 28px;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-head__sub {
  font-size: 13px;
  line-height: 16px;
  color: var(--text-muted);
  margin-top: 8px;
}

.shop-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 0 4px;
}

.shop-group__title {
  min-width: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.34px;
  overflow-wrap: anywhere;
}

.shop-group__count {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 16px;
}

.items {
  display: grid;
  gap: var(--space-2);
}

.item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-4);
  text-align: left;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.item__check {
  width: 24px;
  height: 24px;
  padding: 0;
  flex: none;
  border-radius: 8px;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.item__check svg { width: 14px; height: 14px; }

.item--bought .item__check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.item__name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.item__name--button {
  text-align: left;
  padding: 0;
  background: none;
  border: 0;
  font-family: inherit;
  color: inherit;
}

.item--bought .item__name {
  color: var(--text-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.item__more {
  flex: none;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

/* Поле «добавить позицию» */
.add-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: 8px;
}

.add-row__input {
  flex: 1;
  min-width: 0;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: transparent;
  font-size: 16px;
  line-height: 20px;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.add-row__input::placeholder {
  color: var(--text-soft);
}

.add-row__input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.add-row__btn {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 4px 20px -8px color-mix(in srgb, var(--accent) 75%, transparent);
  transition: transform 0.14s ease;
}

.add-row__btn:active { transform: scale(0.92); }

/* --- Кнопки --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.14s ease, opacity 0.16s ease, background 0.16s ease;
  line-height: 17px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 4px 18px -12px color-mix(in srgb, var(--accent) 75%, transparent);
}

.btn--soft {
  background: var(--surface-2);
  color: var(--text);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--block { width: 100%; }

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row .btn { flex: 1; }

/* --- Пустые состояния ------------------------------------------------------ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 34px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty--plain {
  background: transparent;
  box-shadow: none;
  padding: 20px;
}

.empty__emoji {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 27px;
  border-radius: 50%;
  background: var(--surface-2);
  margin-bottom: 2px;
}

.empty__title {
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
}

.empty__text {
  font-size: 14px;
  line-height: 18px;
  color: var(--text-muted);
  max-width: 218px;
}

/* --- Нижняя навигация и кнопка «плюс» ------------------------------------- */

.tabbar {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(430px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--tabbar-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 47px;
  padding: 7px 4px;
  border-radius: var(--radius-pill);
  color: var(--text-soft);
  transition: color 0.18s ease, background 0.18s ease;
}

.tabbar__item.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tabbar__icon {
  font-size: 17px;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.18s ease;
}

.tabbar__item.is-active .tabbar__icon {
  opacity: 1;
}

.tabbar__label {
  font-size: 11px;
  line-height: 13px;
  font-weight: 700;
  letter-spacing: 0.105px;
}

.fab {
  position: fixed;
  z-index: 31;
  right: max(18px, calc(50% - 262px));
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 4px 30px -12px color-mix(in srgb, var(--accent) 75%, transparent),
    0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.16s ease, opacity 0.2s ease;
}

.fab:active { transform: scale(0.92); }
.fab.is-hidden { opacity: 0; pointer-events: none; transform: scale(0.6); }

/* --- Загрузка и скелетоны -------------------------------------------------- */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Тост ----------------------------------------------------------------- */

.toast-root {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: min(400px, calc(100% - 12px));
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #201d1b;
  color: #f7f4f0;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

[data-theme="dark"] .toast {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.toast--error {
  background: #d64545;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* --- Нижние панели (sheets) ------------------------------------------------ */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.sheet-root.is-open { pointer-events: auto; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 15, 0.42);
  opacity: 0;
  transition: opacity 0.26s ease;
}

.sheet-root.is-open .sheet-backdrop { opacity: 1; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px var(--space-6) calc(var(--space-6) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(102%);
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-lg);
}

.sheet-root.is-open .sheet { transform: none; }

.sheet__handle {
  width: 38px;
  height: 5px;
  margin: 6px auto 14px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
}

[data-theme="dark"] .sheet {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.576);
}

[data-theme="dark"] .sheet__handle {
  background: rgba(246, 242, 238, 0.14);
}

.sheet__title {
  font-size: 21px;
  font-weight: 800;
  line-height: 23px;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.sheet__sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 18px;
  margin-bottom: 16px;
}

.sheet__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.sheet__footer {
  display: flex;
  gap: 8px;
  margin-top: var(--space-5);
}

.sheet__footer .btn {
  flex: 1;
  min-height: 48px;
  line-height: 20px;
}

/* --- Формы ----------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: var(--text-soft);
  padding-left: 2px;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 14px 15px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--surface-2);
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  transition: border-color 0.16s ease, background 0.16s ease;
  appearance: none;
}

.input[type="date"] { min-height: 53px; }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-soft); font-weight: 400; }

.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.4;
}

.select {
  min-height: 51px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.field .hint {
  font-size: 12px;
  line-height: 16px;
}

/* Выбор категории */
.tag-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tag-option {
  min-height: 67px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 2px solid transparent;
  font-size: 13px;
  font-weight: 700;
  line-height: 17px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.tag-option__emoji { font-size: 18px; line-height: 1; }

.tag-option.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Быстрые кнопки дат */
.quick-dates {
  display: flex;
  gap: 8px;
}

.quick-date {
  flex: 1;
  padding: 10px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: var(--text-muted);
  transition: background 0.16s ease, color 0.16s ease;
}

.quick-date.is-active {
  background: var(--text);
  color: var(--bg);
}

/* Переключатель «весь день / время» */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.switch-row__text {
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
}

.switch-row__hint {
  font-size: 12px;
  line-height: 15px;
  color: var(--text-muted);
  margin-top: 2px;
}

.switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.switch.is-on { background: var(--accent); }
.switch.is-on::after { transform: translateX(20px); }

.row-inline {
  display: flex;
  gap: 10px;
}

.row-inline > * { flex: 1; }

.hint {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* --- Служебные мелочи ------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.is-locked { overflow: hidden; }

/* --- Большие экраны -------------------------------------------------------- */

@media (min-width: 640px) {
  .app {
    min-height: calc(100dvh - 48px);
    margin-top: 24px;
    margin-bottom: 24px;
    border-radius: 34px;
    background: var(--bg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  .topbar { border-radius: 34px 34px 0 0; }
  .fab { right: calc(50% - 260px); }
}

.hero__intro {
  display: flex;
  align-items: center;
  min-height: 88px;
  position: relative;
  z-index: 2;
}

.hero__copy { min-width: 0; max-width: 232px; overflow-wrap: anywhere; }

/* Кадрирование соответствует матрицам IMAGE/CROP в Figma. */
.hero__figure {
  position: absolute;
  top: 0;
  right: 0;
  height: 199px;
  z-index: 1;
  opacity: 0.7;
  background-repeat: no-repeat;
  pointer-events: none;
}

.hero__figure--katya {
  width: 134px;
  background-image: url("../assets/katya-hero.png");
  background-size: 223.03576% 199.0305%;
  background-position: 39.65439% 12.56119%;
}

.hero__figure--dima {
  width: 117px;
  background-image: url("../assets/dima-hero.png");
  background-size: 278.67044% 220.06022%;
  background-position: 52.65229% 12.47855%;
  transform: scaleX(-1);
}

/* Адаптивность: ограничиваем внутренние размеры, а не скрываем ошибки страницы. */
.app, .screen, .section, .shop-list, .shop-card, .shop-card__top,
.list-head, .field, .sheet__body, .row-inline > *, .topbar__hello,
.hero-stat, .tag-option, .quick-date, .btn-row .btn, .sheet__footer .btn {
  min-width: 0;
}
.shop-card { max-width: 100%; }
.topbar__actions { flex-shrink: 0; }
.topbar__greeting, .section__title, .sheet__title, .sheet__sub,
.list-head__sub, .empty, .toast, .tag-option, .btn { overflow-wrap: anywhere; }
.section__head { flex-wrap: wrap; }
.section__action { flex-shrink: 0; }
.tag-picker, .tabbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.input, .textarea, .select { min-width: 0; max-width: 100%; font-size: 16px; }
.sheet { max-height: 92dvh; }
/* Запас для плавающей кнопки и навигации при прокрутке до конца. */
.app { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
@media (max-width: 380px) {
  .screen { padding-inline: 12px; }
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar__greeting { font-size: 21px; }
  .hero { padding: 16px 12px; }
  .hero__title { font-size: 21px; }
  .hero-stat { padding: 8px 6px; }
  .hero-stat__label { overflow-wrap: anywhere; }
  .shop-card { padding: 14px 12px; }
  .event { grid-template-columns: 26px 52px minmax(0, 1fr); gap: 7px; padding-inline: 10px; }
  .segmented__btn { font-size: 12px; padding-inline: 3px; }
  .sheet { padding-inline: 14px; }
  .row-inline { flex-wrap: wrap; }
  .row-inline > * { flex: 1 1 120px; }
  .sheet__footer .btn, .btn-row .btn { padding-inline: 8px; }
}
