:root {
  --bg: #f5f3ef;
  --card: #ffffff;
  --ink: #1f1d1a;
  --muted: #8a857d;
  --line: #e6e2db;
  --accent: #1f1d1a;
  --soft: #ece8e1;
  --warn: #a8641c;
  --radius: 14px;
  --tabs-h: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
#app { max-width: 520px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 24px; }

h1 { font-size: 22px; font-weight: 600; margin: 4px 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }

/* нижние вкладки */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding: 8px 16px env(safe-area-inset-bottom);
  background: rgba(245, 243, 239, 0.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
#tabs[hidden] { display: none; }
#tabs button { flex: 1; max-width: 160px; border-radius: 12px; font-size: 14px; color: var(--muted); height: 44px; }
#tabs button.on { color: var(--ink); background: var(--card); font-weight: 600; }

/* общие элементы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0 20px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: 16px; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }

/* вход */
.login { display: flex; flex-direction: column; align-items: center; padding-top: 12vh; gap: 20px; }
.login .logo { font-size: 28px; font-weight: 600; }
.dots { display: flex; gap: 14px; height: 18px; }
.dots span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); }
.dots span.on { background: var(--ink); }
.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.pad button { height: 72px; border-radius: 50%; background: var(--card); font-size: 26px; border: 1px solid var(--line); }
.pad button.blank { visibility: hidden; }

/* погода и события */
.weather { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.weather b { font-size: 20px; font-weight: 600; }
.day-switch { display: flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.day-switch button { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.day-switch button.on { background: var(--card); color: var(--ink); font-weight: 600; }
.events { margin: 10px 0 6px; }
.events .chip { height: 32px; padding: 0 12px; font-size: 13px; }
.events::-webkit-scrollbar { display: none; }
.picked { background: #e9f1e6; color: #2f5a27; border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin: 8px 0; }

/* ленты */
.rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.row-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 0 2px; text-transform: lowercase; }
.row-head .note { color: var(--warn); }
.row-wrap { position: relative; }
.strip { --cw: min(44vw, 190px); display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px calc(50% - var(--cw) / 2); scrollbar-width: none; overscroll-behavior-x: contain; }
.strip::-webkit-scrollbar { display: none; }
.card { flex: 0 0 var(--cw); scroll-snap-align: center; background: var(--card); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; transition: transform .15s, opacity .15s; opacity: .45; transform: scale(.9); }
.card.on { opacity: 1; transform: none; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.card.none { border: 1.5px dashed var(--line); background: transparent; color: var(--muted); font-size: 14px; }
.row-big .card { height: 128px; }
.row-mid .card { height: 92px; }
.row-small .card { height: 64px; }
.lock { height: 26px; padding: 0 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 12px; color: var(--muted); text-transform: none; }
.lock.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.row-head .right { display: flex; align-items: center; gap: 8px; }
.row-empty { background: var(--card); border-radius: var(--radius); padding: 14px; font-size: 14px; color: var(--muted); text-align: center; }
.actions { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); display: flex; gap: 10px; margin-top: 14px; z-index: 5; }
.actions .btn { flex: 1; }

/* гардероб */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 3 / 4; background: var(--card); border-radius: 12px; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.tile.off img { opacity: .35; }
.tile .badge { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: var(--soft); border-radius: 6px; padding: 2px 6px; }
.tile.add { display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--muted); border: 1.5px dashed var(--line); background: transparent; }
.filter { overflow-x: auto; flex-wrap: nowrap; margin-bottom: 12px; scrollbar-width: none; }
.filter::-webkit-scrollbar { display: none; }

/* карточка вещи */
.preview { position: relative; background: var(--card); border-radius: var(--radius); height: 280px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 10px; }
.preview .status { position: absolute; inset: auto 0 0 0; padding: 10px; text-align: center; font-size: 13px; color: var(--muted); background: rgba(255,255,255,.85); }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; height: 40px; border-radius: 10px; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.colors { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.colors button { aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.colors button.on { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.link-danger { color: #b3261e; font-size: 14px; text-align: center; padding: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 12px; padding: 12px 14px; margin-top: 18px; font-size: 15px; }
.switch input { width: 22px; height: 22px; accent-color: var(--ink); }

/* история */
.hist { background: var(--card); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.hist .thumbs { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 10px; }
.hist .thumbs img { width: 64px; height: 80px; object-fit: contain; background: var(--bg); border-radius: 8px; padding: 3px; flex: 0 0 auto; }
.hist .top-row .btn { height: 34px; }

/* настройки */
.field { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; font-size: 15px; gap: 12px; }
.field input { width: 72px; height: 36px; border: 1px solid var(--line); border-radius: 8px; text-align: center; background: var(--bg); }

.empty-state { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty-state .btn { margin-top: 16px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 20; max-width: 90vw; }
#toast[hidden] { display: none; }
