/* ── Вхід / Реєстрація: світлий, той самий каркас що й застосунок ── */
.auth-screen {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px calc(24px + var(--safe-b));
  background: var(--greige);
  overflow-y: auto;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-brand {
  font-family: var(--font-mono); font-weight: 500; font-size: 13px;
  letter-spacing: .32em; text-transform: uppercase;
  color: var(--ink-60); text-align: center; margin-bottom: 10px;
}
.auth-box h1 { text-align: center; margin-bottom: 26px; }
.auth-box .auth-err { color: var(--danger); }

/* ── Картка речі: фото край у край ── */
.item-hero-wrap {
  margin: -18px -16px 0;             /* фото виходить за паддінги екрана */
  position: relative;
}
@media (min-width: 700px) { .item-hero-wrap { margin-top: -32px; } }
.item-hero {
  width: 100%; max-height: 68dvh; object-fit: cover;
  background: var(--linen);
  animation: hero-in .28s ease;      /* друга з двох дозволених анімацій */
}
@keyframes hero-in { from { opacity: 0; transform: scale(.99); } to { opacity: 1; transform: none; } }
.no-photo-hero {
  display: grid; place-items: center;
  aspect-ratio: 3 / 2;
  background: var(--linen);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-60);
}
.hero-back {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; z-index: 2;
  width: 44px; height: 44px; display: grid; place-items: center;
  border: none; border-radius: 50%; cursor: pointer;
  color: var(--on-photo);
}
.hero-back svg { width: 26px; height: 26px; }
.item-title { margin-top: 18px; }
.item-cpw-num { font-size: 26px; }

/* ── Полі: діалог ── */
.poli-head h1 { display: flex; align-items: baseline; gap: 8px; }
.poli-monogram { color: var(--sage); }  /* монограма без кола і підложки */
.poli-chat { display: grid; gap: 14px; align-content: start; margin-top: 6px; }
.poli-chat-empty {
  min-height: calc(100dvh - 320px);
  align-content: center; justify-items: center;
}
.poli-chat-empty .msg { max-width: 420px; }
.poli-chat-empty .poli-suggests { justify-content: center; }
.msg { max-width: 88%; }
.msg-user {
  justify-self: end;
  background: var(--ink); color: var(--greige);
  padding: 12px 18px; border-radius: 20px; border-bottom-right-radius: 6px;
  font-size: 15px;
}
.msg-poli { justify-self: start; display: flex; gap: 10px; align-items: flex-start; width: 100%; }
.msg-poli .bubble {
  background: var(--veil-bg);
  border: 1px solid var(--glass-edge);
  padding: 14px 16px; border-radius: 20px; border-top-left-radius: 6px;
  display: grid; gap: 12px; min-width: 0; flex: 1;
}
.msg-poli .poli-note { font-size: 15px; }
.msg-poli .why { font-size: 14px; color: var(--ink-60); }
.poli-items { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.poli-items::-webkit-scrollbar { display: none; }
.poli-items img, .poli-items .ai-item-ph {
  width: 96px; height: 128px; object-fit: cover;
  border-radius: var(--radius-photo); flex: 0 0 auto;
  background: var(--linen);
}
.ai-item-ph {
  display: grid; place-items: center;
  border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-60);
  text-align: center; padding: 6px;
}
.poli-suggests { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.poli-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Образи: колажі 2×2 з назвою на градієнті ── */
.outfit-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 18px; }
@media (min-width: 700px) { .outfit-grid { grid-template-columns: repeat(2, 1fr); } }
.outfit-card {
  position: relative; border: none; padding: 0; cursor: pointer;
  border-radius: var(--radius-photo); overflow: hidden; background: var(--linen);
  text-align: left; display: block; width: 100%;
}
.collage {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  aspect-ratio: 4 / 3;
}
.collage > * { width: 100%; height: 100%; object-fit: cover; background: var(--linen); min-height: 0; }
.collage .ai-item-ph { border: none; }
.collage.n1 { grid-template-columns: 1fr; }
.outfit-card { aspect-ratio: 4 / 5; }
.outfit-card > img, .outfit-card .collage { position: absolute; inset: 0; width: 100%; height: 100%; }
.outfit-card .collage { aspect-ratio: auto; }
.outfit-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(28, 27, 25, .6), rgba(28, 27, 25, 0) 55%);
  pointer-events: none;
}
.outfit-card .over {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 14px;
  background: none;
}
.outfit-card .over h2 { color: var(--on-photo); font-size: 24px; }
.outfit-card .over .micro { color: rgba(247, 245, 241, .85); margin-top: 2px; }

/* ── Список покупок: типографіка без фото ── */
.wish-list { display: grid; gap: 2px; margin-top: 18px; }
.wish-item { background: var(--linen); border-radius: var(--radius-photo); padding: 18px 16px; }
.wish-item h2 { font-size: 26px; }
.wish-quote { margin-top: 8px; color: var(--ink-60); font-size: 15px; }
.wish-quote::before { content: "Полі: "; color: var(--sage); font-weight: 500; }
.wish-pairs { margin-top: 10px; }

/* ── Статистика ── */
.stat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; margin-top: 18px; }
.stat-tile { background: var(--linen); border-radius: var(--radius-photo); padding: 18px 16px; display: grid; gap: 2px; }
.stat-tile .num { font-family: var(--font-mono); font-weight: 500; font-size: 28px; }
.stat-card { background: var(--linen); border-radius: var(--radius-photo); padding: 18px 16px; margin-top: 2px; }
.chart-box { position: relative; }

/* Секції */
.section-title { margin-top: 28px; }
.fact { display: grid; gap: 3px; }

/* Липка скляна шапка екрана: заголовок + стрічка фільтрів одним шаром */
.screen-head {
  position: sticky; top: 0; z-index: 20;
  margin: calc(-1 * max(18px, calc(env(safe-area-inset-top) + 10px))) -16px 14px;
  padding: max(12px, calc(env(safe-area-inset-top) + 6px)) 16px 10px;
}
@media (min-width: 700px) {
  .screen-head { margin-top: calc(-1 * max(32px, calc(env(safe-area-inset-top) + 16px))); }
}
.screen-head h1 { font-size: 26px; }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* Повний набір фільтрів у шторці: чипи переносяться, нічого не обрізається */
.chips-wrap { flex-wrap: wrap; overflow: visible; }

/* ── Сегмент-контрол СІТКА | КАЛЕНДАР ── */
.seg {
  display: inline-flex; gap: 2px;
  background: var(--linen); border-radius: var(--radius-pill); padding: 3px;
}
.seg button {
  border: none; background: transparent; cursor: pointer;
  min-height: 38px; padding: 6px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-weight: 500; font-size: 13px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-60);
}
.seg button[aria-pressed="true"] { background: var(--greige); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* ── Календар носки ── */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.cal-nav h2 { font-size: 24px; letter-spacing: .04em; }
.cal-nav button {
  width: 44px; height: 44px; border: none; background: none; cursor: pointer;
  font-size: 22px; color: var(--ink); border-radius: 50%;
}
.cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 10px;
}
.cal-week span {
  font-family: var(--font-display); font-style: italic; font-size: 14px;
  color: var(--ink-60); text-align: center; padding: 4px 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; touch-action: pan-y; }
.cal-cell {
  position: relative; aspect-ratio: 3 / 4; min-width: 0;
  border: none; padding: 0; background: none; cursor: pointer;
  border-radius: 3px; overflow: hidden;
}
.cal-cell img { width: 100%; height: 100%; object-fit: cover; }
.cal-cell .dnum {
  position: absolute; top: 3px; left: 5px; z-index: 1;
  font-family: var(--font-mono); font-weight: 500; font-size: 10px;
  color: var(--ink-60);
}
.cal-cell.has-img .dnum {
  color: var(--on-photo);
  text-shadow: 0 1px 3px rgba(28, 27, 25, .55);
}
.cal-cell.today { outline: 1px solid var(--ink); outline-offset: -1px; }
.cal-cell .stack {
  position: absolute; right: 4px; bottom: 4px; z-index: 1;
  width: 14px; height: 14px;
  color: var(--on-photo); filter: drop-shadow(0 1px 2px rgba(28, 27, 25, .6));
}
.cal-sheet-cover { width: 100%; border-radius: var(--radius-photo); background: #fff; }

/* Знак Полі — SVG, дві теми */
.poli-avatar { flex: 0 0 auto; display: inline-grid; }
.poli-avatar .pm-bg { fill: var(--sage); }
.poli-avatar .pm-letter { fill: var(--linen); font-family: var(--font-display); }
.poli-avatar--dark .pm-bg { fill: var(--linen); }
.poli-avatar--dark .pm-letter { fill: var(--sage); }

/* Стрічка фільтрів: тихі чипи — мікро-типографіка, тонкі межі */
.filter-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin-top: 12px; align-items: center; }
.filter-strip::-webkit-scrollbar { display: none; }
.fchip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-60); cursor: pointer;
  font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap;
}
.fchip svg { width: 14px; height: 14px; }
.fchip:hover { color: var(--ink); border-color: var(--ink-60); }
.fchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--greige); }
.fchip-reset { border: none; text-decoration: underline; text-underline-offset: 3px; }

/* Інпут-бар Полі: скло, безпечна зона над таббаром */
.poli-inputbar {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(64px + var(--safe-b));
  padding: 10px 16px;
}
.poli-inputbar .inner {
  max-width: 720px; margin: 0 auto;
  display: grid; gap: 0;
}
.poli-inputbar .inner .row { display: flex; gap: 8px; align-items: center; }
.poli-inputbar .input { flex: 1; border-radius: var(--radius-pill); }
.poli-send {
  flex: 0 0 auto; width: 44px; height: 44px;
  border: none; border-radius: 50%; cursor: pointer;
  background: var(--ink); color: var(--greige);
  display: grid; place-items: center;
}
.poli-send svg { width: 20px; height: 20px; }
.poli-send[disabled] { opacity: .5; }
.poli-chat { padding-bottom: 96px; }  /* останнє повідомлення не ховається під баром */
.poli-suggests { padding-bottom: 8px; }

/* Фото в чаті Полі */
.msg-user img { max-width: 180px; border-radius: 12px; display: block; margin-bottom: 6px; }
.poli-attach {
  flex: 0 0 auto; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--ink);
  display: grid; place-items: center;
}
.poli-attach svg { width: 20px; height: 20px; }
.poli-pending {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px;
}
.poli-pending img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.poli-pending button {
  width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--ink); color: var(--greige); font-size: 13px; line-height: 1;
}
.poli-inputbar { }
.poli-inputbar .inner { position: relative; }

/* «Зібрати образ»: крок 1 — вибір з усього гардероба */
.modal-full { max-height: 96dvh; height: 96dvh; display: flex; flex-direction: column; }
.picker-scroll { flex: 1; overflow-y: auto; margin: 0 -16px; padding: 0 16px 12px; }
.picker-tile { position: relative; }
.picker-tile .check {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--greige);
  font-size: 14px;
}
.picker-tile[aria-pressed="true"] .ph { opacity: .68; }
.picker-bar {
  margin: 0 -16px calc(-16px - var(--safe-b));
  padding: 10px 16px calc(12px + var(--safe-b));
  display: flex; gap: 10px; align-items: center;
}
.picker-bar .sel-strip { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.picker-bar .sel-strip::-webkit-scrollbar { display: none; }
.picker-bar .sel-strip img, .picker-bar .sel-strip .ai-item-ph {
  width: 40px; height: 52px; object-fit: cover; border-radius: 6px; flex: 0 0 auto;
}
