/* Шафа Каті. Три вида: старинный шкаф, современный и модерн.
   Вид выбирается в разделе «Разбор и я» и запоминается на устройстве. */

/* Ширина колонки приложения: одна на все виды и на все закреплённые полосы. */
:root {
  --col: 880px;
  /* Высоту нижнего меню меряет сам браузер: см. measureNav в app.js.
     Значение здесь только на случай, если скрипт ещё не отработал. */
  --nav-h: 60px;
}

/* Колонка растёт ступенями вместе с экраном: на телефоне занимает всё,
   на большом мониторе перестаёт быть узкой полоской посередине. */
@media (min-width: 1024px) { :root { --col: 1000px; } }
@media (min-width: 1500px) { :root { --col: 1160px; } }

:root,
:root[data-theme='antique'] {
  /* Старинный шкаф: тёплое дерево, латунь, кремовая подкладка ящиков. */
  --bg: #efe3d0;
  --surface: #fbf3e4;
  --surface-2: #e6d5ba;
  --ink: #2f2114;
  --ink-soft: #6f5a41;
  --line: #a8916c;
  --accent: #7c4a24;
  --accent-ink: #fdf6e8;
  --danger: #98362c;
  --radius: 14px;
  --gap: 12px;
  --font: Georgia, 'Times New Roman', serif;
  --title-font: Georgia, 'Times New Roman', serif;
  --title-spacing: 0.01em;
  --panel-shadow: 0 2px 0 rgba(120, 88, 50, 0.18);
  /* Текстура дерева: полосы вместо картинки, чтобы ничего не грузить. */
  --wood: repeating-linear-gradient(
    90deg,
    rgba(124, 74, 36, 0.05) 0px,
    rgba(124, 74, 36, 0.05) 2px,
    rgba(124, 74, 36, 0) 2px,
    rgba(124, 74, 36, 0) 9px
  );
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme='modern'] {
  /* Современный: светлый, спокойный, без украшений. */
  --bg: #f7f3ee;
  --surface: #fffdfb;
  --surface-2: #f1eae1;
  --ink: #241f1a;
  --ink-soft: #6b625a;
  --line: #c4b6a6;
  --accent: #8a4a3d;
  --accent-ink: #fff8f4;
  --danger: #a33a34;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --title-font: var(--font);
  --title-spacing: -0.01em;
  --panel-shadow: none;
  --wood: none;
}

:root[data-theme='deco'] {
  /* Модерн: тёмный фон, латунь и зелень, как вечерняя витрина. */
  --bg: #14151a;
  --surface: #1d1f26;
  --surface-2: #272a33;
  --ink: #f3efe7;
  --ink-soft: #a9a396;
  --line: #565b6d;
  --accent: #c9a24b;
  --accent-ink: #1b1c22;
  --danger: #e08070;
  --radius: 10px;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --title-font: var(--font);
  --title-spacing: 0.06em;
  --panel-shadow: none;
  --wood: none;
}

/* Системная тёмная схема применяется к современному виду:
   у старинного и модерна свои цвета, и подменять их не нужно. */
@media (prefers-color-scheme: dark) {
  :root[data-theme='modern'] {
    --bg: #16130f;
    --surface: #211c17;
    --surface-2: #2b241d;
    --ink: #f2ece5;
    --ink-soft: #b3a89c;
    --line: #584c41;
    --accent: #d99178;
    --accent-ink: #1d1712;
    --danger: #e0796f;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: var(--wood);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
}

body.sheet-open { overflow: hidden; }
body.sheet-open .nav { pointer-events: auto; }

/* Приложение это одна колонка по центру экрана: и содержимое, и шапка,
   и нижнее меню. На широком мониторе оно не растягивается на всю ширину,
   а стоит посередине, как на телефоне. */
.app {
  /* Сверху место под закреплённую шапку, снизу под меню. */
  padding: 78px 16px calc(var(--nav-h) + 24px);
  width: min(100%, var(--col));
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* На широком экране колонка отделена от фона: видно, где кончается приложение. */
@media (min-width: 860px) {
  body { background: color-mix(in srgb, var(--bg) 88%, #000); }
  .app, .head-row, .nav, .chat-dock, .sheet {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* Шапка раздела */
.head { display: flex; flex-direction: column; gap: var(--gap); }
.head-row {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--col));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-row { padding: 8px 14px; min-height: 54px; transition: box-shadow 0.18s ease; }
.head-row .title { font-size: 19px; }
/* Тень появляется только когда под шапкой уже что-то проехало. */
body.scrolled .head-row { box-shadow: 0 10px 22px -18px rgba(0, 0, 0, 0.75); }
/* Значок приложения вместо стрелки, когда возвращаться некуда. */
.head-mark { width: 24px; height: 24px; color: var(--accent); flex: none; display: block; }
.head-mark svg { width: 100%; height: 100%; }
.head-count { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
/* Кружечок Каті: звичне місце «моє і налаштування». */
.head-me {
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--title-font);
  cursor: pointer;
}
.head-me:hover { border-color: var(--accent); color: var(--accent); }
.head-me.with-photo { padding: 0; overflow: hidden; }
.head-me img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Переключатель из двух половин: видно оба положения и то, какое сейчас. */
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  margin: 4px 0 2px;
}
.segment {
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-soft);
  padding: 12px 20px;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.segment.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.segment:not(.on):hover { color: var(--ink); }

/* Виды вещей: словарные серым, свои цветом. */
.type-block { margin: 0 0 18px; }
.type-block .chips { gap: 8px; }
.type-block .section-title { margin: 0 0 8px; }
.chip.muted { background: var(--surface-2); color: var(--ink-soft); border-style: dashed; cursor: default; }

/* Вещь не под рукой: убрана на сезон или уложена в чемодан. */
.card.away .card-photo { opacity: 0.55; }
.card-away { font-size: 11px; color: var(--ink-soft); padding: 0 2px 4px; text-align: left; }

/* Образ дня на главном экране: строка, а не плакат во весь экран. */
.today-look {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.today-thumbs { display: flex; gap: 4px; flex: none; }
.today-thumb {
  width: 52px;
  height: 66px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  flex: none;
}
.today-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.today-look-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.today-look-info .look-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ОДНА ШИРИНА НА ЭКРАНЕ.
   Прошлая попытка развела содержимое на два размера: текст и кнопки по центру
   узкой полосой, а фотографии от края до края. Выглядит как две разные
   страницы. Поэтому ширина теперь одна: всё, что на экране, выравнивается
   по одним и тем же краям колонки, а колонка растёт вместе с монитором.
   Отдельно ограничен только абзац текста, и то по левому краю: строка длиннее
   восьмидесяти знаков читается тяжело. */
.hint,
.empty-text,
.look-why,
.lookEditor-note { max-width: 80ch; }

/* Коллаж и календарь не раздуваются в афиши: ячейка знает свой предел. */
.collage { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.event-photo, .import-photo { max-width: 100%; }

/* Переписка: пузырь короче колонки, иначе строка тянется через весь монитор. */
.chat .bubble { max-width: min(92%, 760px); }

/* Просмотр образа во весь экран: тёмный фон, фотография целиком, листание.
   Так смотрят фотографии везде, и незачем выдумывать своё. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: rgba(12, 10, 8, 0.92);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.lightbox.in { opacity: 1; }
.lightbox-stage {
  position: relative;
  width: min(100%, 720px);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}
.lightbox-photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}
.lightbox-collage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  width: 100%;
  max-height: 100%;
  overflow: auto;
}
.lightbox-collage .collage-cell { background: rgba(255, 255, 255, 0.07); border-radius: 10px; }
.lightbox-close,
.lightbox-arrow {
  position: absolute;
  appearance: none;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close { top: 0; right: 0; width: 46px; height: 46px; font-size: 24px; }
.lightbox-arrow { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 20px; }
.lightbox-arrow.prev { left: 0; }
.lightbox-arrow.next { right: 0; }
.lightbox-close:hover,
.lightbox-arrow:hover { background: rgba(0, 0, 0, 0.7); }
.lightbox-caption {
  width: min(100%, 720px);
  flex: 0 0 auto;
  color: #f4efe8;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lightbox-title { font-size: 17px; font-weight: 600; font-family: var(--title-font); }
.lightbox-line { font-size: 13px; color: rgba(244, 239, 232, 0.72); }
.lightbox-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.lightbox-actions .chip { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #f4efe8; }
.lightbox-actions .chip.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.lightbox-actions .chip.danger { color: #ffb3a7; }

/* Кадрирование: окно, в котором видно ровно то, что сохранится. */
.crop-frame {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1;
  margin: 12px 0;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  touch-action: none;
  cursor: grab;
}
.crop-frame.round { border-radius: 50%; }
.crop-frame:active { cursor: grabbing; }
.crop-image { position: absolute; top: 0; left: 0; transform-origin: top left; user-select: none; -webkit-user-drag: none; max-width: none; }
.crop-zoom { width: 100%; }

/* Фотография хозяйки в меню «Моє» */
.me-row { display: flex; align-items: center; gap: 16px; margin: 4px 0 20px; }
.me-face {
  width: min(140px, 34vw);
  height: min(140px, 34vw);
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  font-family: var(--title-font);
  color: var(--ink-soft);
}
.me-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.me-actions .btn { width: 100%; }

/* Переключатели в «Моє»: строка списка со словом справа. */
.list-item.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch-state { color: var(--ink-soft); font-size: 13px; }
.list-item.switch.on .switch-state { color: var(--accent); }
/* Слева стрелка назад и название, справа счётчик и действия раздела. */
.head-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.head-left .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-right { display: flex; align-items: center; gap: 8px; }
.head-right .mark { width: 44px; height: 44px; padding: 11px; }
.title { font-size: 26px; font-weight: 650; margin: 0; font-family: var(--title-font); letter-spacing: var(--title-spacing); }
.count { color: var(--ink-soft); font-size: 14px; }

.hint { color: var(--ink-soft); font-size: 13px; }
.hint.locked { color: var(--accent); }

/* Кнопки */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
}
.btn:active { transform: scale(0.99); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; }

.icon-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  padding: 6px 10px 6px 0;
  cursor: pointer;
}

/* Поиск */
.search {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 16px;
}

/* Табы категорий */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0;
  padding: 2px 0;
}
/* На широком экране перенос строкой: скрытая горизонтальная прокрутка
   на десктопе читается как обрезанная страница. */
@media (min-width: 760px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 11px 16px;
  min-height: 44px;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* Отклик на касание: без него человек нажимает второй раз, не поверив,
   что первое сработало. Касается всего, что нажимается. */
.chip:active,
.tab:active,
.mark:active,
.card:active,
.list-item:active,
.nav-btn:active,
.month-cell:active,
.segment:active,
.icon-btn:active,
.theme-card:active { transform: scale(0.97); }
.chip[disabled],
.btn[disabled],
.mark[disabled],
.segment[disabled] { opacity: 0.5; cursor: default; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.banner {
  width: 100%;
  text-align: left;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
}

/* Загрузка */
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-text { font-size: 13px; color: var(--ink-soft); }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); transition: width 0.2s ease; }

/* Сетка вещей */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  margin-top: 16px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-photo {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute;
  left: 8px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
}
.card-label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-title {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); flex: 0 0 auto; }
.dot.unknown { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--line) 3px, var(--line) 6px); }

/* Пустые состояния */
.empty { padding: 48px 8px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.empty-title { font-size: 20px; margin: 0; }
.empty-text { color: var(--ink-soft); font-size: 15px; grid-column: 1 / -1; }

/* Нижнее меню */
.nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--col));
  bottom: 0;
  display: flex;
  /* Кнопки держатся кучкой по центру: на широком экране растягивать их
     через всю ширину неудобно и некрасиво. */
  justify-content: center;
  gap: 4px;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.nav-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 12px 12px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 10px;
  white-space: nowrap;
}
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.on { color: var(--accent); font-weight: 600; }

/* Панель поверх экрана: карточка вещи, фильтры, сортировка */
.sheet {
  position: fixed;
  /* Панель это та же колонка по центру, а не полотно во весь монитор. */
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--col));
  margin-left: calc(min(100%, var(--col)) / -2);
  /* Панель перекрывает закреплённую шапку раздела целиком. */
  z-index: 36;
  background: var(--bg);
  overflow-y: auto;
  /* Снизу оставляем место под меню: оно видно всегда, даже поверх панели. */
  padding: 0 20px calc(var(--nav-h) + 32px);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.sheet.in { transform: none; opacity: 1; }

/* Содержимое панели держится той же колонкой, что и основной экран.
   Центрируем через align-items, а не через авто-отступы: у блоков внутри
   свои margin, и они такие отступы затирали, из-за чего текст уезжал влево. */
.sheet {
  display: flex;
  flex-direction: column;
  /* По центру: блоки с пределом ширины стоят на одной оси, а не прижаты к краю. */
  align-items: center;
}
.sheet > * {
  width: 100%;
  /* Панель живёт по тем же краям, что и экран под ней: раньше её содержимое
     было уже, и панель читалась как другая страница. */
  max-width: 100%;
  flex: 0 0 auto;
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 14px 0 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.sheet-title { font-size: 18px; font-weight: 600; font-family: var(--title-font); letter-spacing: var(--title-spacing); }

/* Блоки панели разделены не только заголовком: без воздуха и линии
   четыре разные настройки читаются как одна длинная простыня. */
.sheet > .section-title {
  margin: 30px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.sheet > .section-title:first-of-type { border-top: none; padding-top: 0; margin-top: 18px; }
.sheet > .list { margin-bottom: 6px; }
.sheet > .fields { margin-bottom: 10px; }
.sheet > .hint + .list { margin-top: 10px; }

.item-photo {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 16px;
  max-height: 46vh;
  display: flex;
  justify-content: center;
}
.item-photo img { width: 100%; object-fit: contain; }
.item-photo-empty { padding: 48px 0; color: var(--ink-soft); font-size: 14px; }

/* Форма вещи это сетка, а не колбаса: короткие поля стоят парами,
   длинные занимают строку целиком. */
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}
.fields > .field.wide,
.fields > .chips-field { grid-column: 1 / -1; }

/* Второй блок формы: открывается, когда действительно нужен. */
.more-fields {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 14px;
  background: var(--surface);
}
.more-fields > summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
  list-style: none;
}
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::before { content: '+ '; color: var(--accent); }
.more-fields[open] > summary::before { content: '- '; }
.more-fields[open] > summary { margin-bottom: 12px; color: var(--ink); }

/* Старые образы: карточка на каждую фотографию. */
.import-list { display: flex; flex-direction: column; gap: 16px; margin: 14px 0; }
.import-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.import-card.saved { opacity: 0.6; }
.import-photo { border-radius: 10px; overflow: hidden; background: var(--surface-2); max-height: 320px; }
.import-photo img { width: 100%; height: 100%; object-fit: contain; display: block; max-height: 320px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.row { flex-direction: row; align-items: center; gap: 10px; }
.field-label { font-size: 13px; color: var(--ink-soft); }
.field select,
.field input[type='text'],
.field input[type='number'],
.field input[type='date'] {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 16px;
  width: 100%;
}
.field input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--accent); }

.stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0 8px; color: var(--ink-soft); font-size: 13px; }
/* Кнопки панели прижаты к низу: в карточке вещи до них была тысяча точек прокрутки. */
.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding: 10px 0 12px;
  background: linear-gradient(to bottom, transparent, var(--bg) 18%);
}

.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  cursor: pointer;
}
.list-item.on { border-color: var(--accent); color: var(--accent); }

/* Проверка вещей */
.confirm-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.confirm-title { font-size: 18px; font-weight: 600; }

/* Стилист */
.ask { display: flex; gap: 8px; }
.ask .search { flex: 1; }
.looks { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; }
.look { display: flex; flex-direction: column; gap: 10px; }
.look-title { font-size: 17px; font-weight: 600; }
.collage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}
.collage-cell {
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.collage-cell img { width: 100%; height: 100%; object-fit: cover; }
.collage-empty { font-size: 11px; color: var(--ink-soft); padding: 6px; text-align: center; }
.look-items { font-size: 13px; color: var(--ink-soft); }
.look-why { font-size: 15px; line-height: 1.5; }
.look-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.look-actions .btn { flex: 1 1 140px; min-width: 0; white-space: normal; line-height: 1.25; }

/* Календарь */
.month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 16px 0 20px;
}
.month-weekday { font-size: 11px; color: var(--ink-soft); text-align: center; padding-bottom: 4px; }
.month-cell {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 0;
}
.month-cell {
  position: relative;
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-start;
}
.month-cell.empty { border: none; background: none; cursor: default; }
.month-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Фотография образа этого дня заполняет клетку целиком. */
.cell-photo, .cell-collage { position: absolute; inset: 0; }
.cell-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell-collage { display: grid; grid-template-columns: 1fr 1fr; }
.cell-collage span { overflow: hidden; background: var(--surface-2); }
.cell-collage img { width: 100%; height: 100%; object-fit: cover; display: block; }

.month-day {
  position: absolute;
  top: 3px;
  left: 4px;
  z-index: 2;
  font-size: 12px;
  line-height: 1.1;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-radius: 6px;
  padding: 1px 4px;
}
/* Запланированное: образ собран, но ещё не надет. */
.cell-planned {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  z-index: 2;
}
.cell-planned.static { position: static; display: inline-block; flex: none; }
/* Название события из её календаря: подпись по нижнему краю клетки. */
.cell-event {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 4px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* На телефоне клетка узкая: подпись в четыре буквы там бесполезна, поэтому
   событие превращается в полоску по нижнему краю, а клетка становится выше,
   чтобы фотографии образа было где поместиться. */
@media (max-width: 520px) {
  .month { gap: 3px; }
  .month-cell { aspect-ratio: 3 / 4; }
  /* В режиме образов подпись мешает фотографии и превращается в полоску,
     а в режиме событий она и есть содержимое, поэтому остаётся текстом. */
  .month.looks-mode .cell-event {
    font-size: 0;
    line-height: 0;
    height: 4px;
    padding: 0;
    background: var(--accent);
    opacity: 0.55;
  }
  .month.events-mode .cell-event { font-size: 9px; padding: 2px 3px; }
}
.dots { display: flex; gap: 3px; height: 6px; }
.mini-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-soft); }
.mini-dot.worn { background: var(--accent); }
.mini-dot.planned { background: transparent; border: 1px solid var(--accent); }
.mini-dot.from-calendar { background: var(--ink-soft); }
/* Что означают метки под числами: без этой строки сетка нечитаема. */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 4px; color: var(--ink-soft); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .mini-dot { flex: none; }

/* Фотография образа в списке дня: смотреть, а не читать названия. */
.event-photo { border-radius: 12px; overflow: hidden; background: var(--surface-2); max-height: 320px; }
.event-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.day-list { display: flex; flex-direction: column; gap: 16px; }
.event { display: flex; flex-direction: column; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.event-line { display: flex; gap: 8px; align-items: center; }
.event-date { font-size: 13px; color: var(--ink-soft); }
.event-kind { font-size: 11px; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); color: var(--ink-soft); }
.event-kind.worn { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.event-title { font-size: 16px; font-weight: 550; }

.card.chosen .card-photo { outline: 3px solid var(--accent); outline-offset: -3px; }
.picked { margin: 8px 0; }

/* Разбор и цифры */
.numbers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0 8px; }
/* На широком экране четыре в ряд: два огромных прямоугольника читаются хуже. */
@media (min-width: 900px) { .numbers { grid-template-columns: repeat(4, 1fr); } }
.number { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.number-value { font-size: 24px; font-weight: 650; }
.number-label { font-size: 12px; color: var(--ink-soft); }
.section-title { font-size: 17px; font-weight: 600; margin: 24px 0 8px; font-family: var(--title-font); letter-spacing: var(--title-spacing); }
.profile {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  margin-bottom: 8px;
}
.weather { margin-top: 2px; }

/* Лента фотографий в образах */
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.photo-strip::-webkit-scrollbar { display: none; }
.strip-cell {
  flex: 0 0 96px;
  aspect-ratio: 3 / 4;
  border: none;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}
.strip-cell img { width: 100%; height: 100%; object-fit: cover; }

.badge.soft { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line); }

.badge.drop {
  left: auto;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

/* Доступность: видимый фокус для клавиатуры и уважение к отключённой анимации */
:where(button, input, select, textarea, a):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Фраза дня и обучение */
.phrase {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-radius: 14px;
  padding: 12px 14px;
}
.help-step { display: flex; flex-direction: column; gap: 10px; margin: 24px 0; }
.help-count { font-size: 12px; color: var(--ink-soft); }
.help-title { font-size: 22px; margin: 0; }
.help-body { font-size: 16px; line-height: 1.5; margin: 0; color: var(--ink); }
.help-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0; }
.help-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.help-dot.on { background: var(--accent); }

/* Образ по слотам */
.slots { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.slot { display: flex; gap: 12px; align-items: flex-start; }
.slot-photo {
  flex: 0 0 76px;
  width: 76px;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}
.slot-photo img { width: 100%; height: 100%; object-fit: cover; }
.slot-photo.blank {
  border: 2px dashed var(--line);
  background: none;
}
.slot-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.slot-name { font-size: 12px; color: var(--ink-soft); }
.slot-item { font-size: 15px; }
.slot-item.missing { color: var(--ink-soft); font-style: italic; }
.slot-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.slot-options { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.missing-note {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  margin-top: 10px;
}

/* События из её собственного календаря */
.agenda { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.agenda-time { flex: 0 0 62px; font-size: 13px; color: var(--ink-soft); padding-top: 2px; }
.agenda-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.agenda-title { font-size: 15px; }
.mini-dot.agenda { background: var(--ink-soft); }

/* Свои маленькие окна вместо системных */
.dialog-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}
@media (min-width: 560px) { .dialog-back { align-items: center; } }
.dialog {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}
.dialog-title { font-size: 17px; font-weight: 600; }
.dialog-actions { display: flex; gap: 8px; margin-top: 4px; }
.dialog-actions .btn { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  translate: -50% 0;
  width: min(calc(100% - 32px), calc(var(--col) - 32px));
  bottom: calc(var(--nav-h) + 16px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}
.toast.in { opacity: 1; transform: none; }


/* Мелочи, которые отличают старинный шкаф от остальных видов */
:root[data-theme='antique'] .card-photo,
:root[data-theme='antique'] .collage-cell,
:root[data-theme='antique'] .slot-photo {
  box-shadow: inset 0 0 0 1px rgba(124, 74, 36, 0.18), var(--panel-shadow);
}
:root[data-theme='antique'] .btn,
:root[data-theme='antique'] .chip,
:root[data-theme='antique'] .list-item {
  box-shadow: var(--panel-shadow);
}
:root[data-theme='antique'] .nav {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), var(--surface));
  border-top: 2px solid var(--line);
}
:root[data-theme='deco'] .title,
:root[data-theme='deco'] .sheet-title {
  text-transform: uppercase;
  font-size: 22px;
}

/* Разделы как вещи в шкафу */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
}
.tile {
  position: relative;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--panel-shadow);
}
.tile:active { transform: translateY(1px); }
.tile-icon { display: block; width: 34px; height: 34px; color: var(--accent); }
.tile-icon svg { width: 100%; height: 100%; }
.tile-label { font-size: 12px; color: var(--ink-soft); text-align: center; line-height: 1.25; }
.tile-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  color: var(--accent);
}

/* Выбор вида */
.theme-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.theme-card {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
}
.theme-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-name { font-size: 15px; font-weight: 600; }
.theme-swatch { width: 100%; height: 26px; border-radius: 8px; border: 1px solid var(--line); }
.theme-swatch.antique { background: linear-gradient(90deg, #7c4a24 0 33%, #efe3d0 33% 66%, #c9a24b 66%); }
.theme-swatch.modern { background: linear-gradient(90deg, #8a4a3d 0 33%, #f7f3ee 33% 66%, #e2d8cc 66%); }
.theme-swatch.deco { background: linear-gradient(90deg, #14151a 0 33%, #c9a24b 33% 66%, #272a33 66%); }

/* Переключение вариантов в ячейке образа */
.variant-nav { display: flex; align-items: center; gap: 8px; }
.variant-nav .chip { padding: 4px 12px; font-size: 16px; line-height: 1; }
.colors-box { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.colors-box .chip { display: inline-flex; align-items: center; gap: 6px; }

/* Простой график по месяцам */
.chart { display: flex; gap: 6px; align-items: flex-end; height: 120px; margin: 10px 0; overflow-x: auto; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 34px; height: 100%; }
.chart-bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-bar { width: 10px; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bar.added { background: var(--line); }
.chart-bar.worn { background: var(--accent); }
.chart-label { font-size: 10px; color: var(--ink-soft); }

/* Значки действий: на карточке и в шапке карточки вещи */
.mark {
  appearance: none;
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mark svg { width: 100%; height: 100%; }
.mark.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card-marks {
  position: absolute;
  right: 6px;
  top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: -6px 0 14px;
}
.quick-actions .mark { width: 42px; height: 42px; padding: 9px; }

/* Голос и фото рядом с полем */
.input-extras { display: flex; gap: 6px; align-items: center; }
.input-extras .mark { width: 40px; height: 40px; padding: 9px; }
.ask { align-items: center; }

/* Переписка со стилистом */
.chat { display: flex; flex-direction: column; gap: 14px; margin: 14px 0 90px; }
.bubble { display: flex; flex-direction: column; gap: 10px; max-width: 92%; }
.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  padding: 12px 14px;
  width: 100%;
}
.bubble-text { font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
/* Нижний блок переписки: полоска подсказок и поле ввода одним куском,
   прижатым к меню. Ничего не висит в воздухе. */
.chat-dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--col));
  /* Ровно на меню, без щели: высота меню известна точно. */
  bottom: var(--nav-h);
  z-index: 35;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 24px -20px rgba(0, 0, 0, 0.6);
}
.chat-quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 16px 0;
}
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick .chip { white-space: nowrap; flex: none; }
.chat-input {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
}
.chat { padding-bottom: 120px; }

/* ПРАВИЛО НА ВЕСЬ САЙТ: ОРГАНЫ УПРАВЛЕНИЯ НЕ РАСТЯГИВАЮТСЯ.
   Кнопка шириной в монитор читается как ошибка вёрстки, а не как забота:
   палец всё равно попадает в неё с любого места, а глаз теряет, где она
   кончается. Поэтому у кнопки, строки списка и поля есть предел, а ряды
   раскладываются сеткой: на широком экране они становятся в ряд, на узком
   в колонку. Всё выравнивается по левому краю, общему со всем остальным. */
.btn { max-width: 340px; }
.btn.wide { width: 100%; max-width: 340px; margin-left: auto; margin-right: auto; }

.sheet-actions,
.look-actions,
.list,
.me-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 340px));
  gap: 8px;
  justify-content: center;
}
.sheet-actions .btn,
.look-actions .btn,
.me-actions .btn { width: 100%; max-width: none; }
.list-item { max-width: none; }

/* Поля ввода: строка длиннее этого всё равно не читается. */
.ask { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }
.profile, .sheet .field, .app .search { max-width: 560px; margin-left: auto; margin-right: auto; }
.fields { max-width: 100%; }

/* Карточки и коллажи: ячейка знает предел, три вещи не становятся плакатом. */
.collage { grid-template-columns: repeat(auto-fit, minmax(110px, 180px)); justify-content: center; }
.today-look { max-width: 560px; margin-left: auto; margin-right: auto; }
.event-photo, .import-photo { max-width: 420px; margin-left: auto; margin-right: auto; }
.theme-row { grid-template-columns: repeat(auto-fit, minmax(160px, 240px)); justify-content: center; }
.numbers { grid-template-columns: repeat(auto-fit, minmax(150px, 240px)); justify-content: center; }

/* Текст и заголовки: блок по центру, строки внутри читаются слева направо. */
/* Текст держится читаемой ширины, а ряды кнопок пользуются всей строкой:
   рубрики, свёрнутые в три этажа посреди пустой колонки, выглядят сломанными. */
.hint, .empty-text, .look-why, .field-label, .section-title, .phrase, .weather {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.chips, .controls, .tabs, .legend {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.chips, .controls, .legend, .tabs { justify-content: center; }

/* Заголовки и подписи на экранах тоже по центру: иначе строка слева, а блок
   под ней посередине, и страница выглядит собранной из двух вёрсток. */
.app > .head > .phrase,
.app > .head > .weather,
.app > .hint,
.app > .empty-text,
.app > .section-title,
.looks > .field-label,
.looks > .hint,
.looks .look-title,
.looks .look-items,
.looks .look-why,
.day-list > .field-label,
.legend { text-align: center; }

/* Внутри карточек, списков и переписки текст остаётся слева: там его читают,
   а не разглядывают. */
.list-item, .sheet .field, .bubble, .event-title, .agenda-info, .import-card { text-align: left; }

/* Переключатель календаря тоже по центру, как и всё остальное. */
.segmented { display: flex; width: fit-content; margin-left: auto; margin-right: auto; }
