/* Вільна Хата — iOS-like design system (HIG semantics, light/dark) */
:root {
  --bg: #f2f2f7;
  --card: #fff;
  --card2: #f2f2f7;
  --label: #000;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .2);
  --fill: rgba(120, 120, 128, .12);
  --fill2: rgba(120, 120, 128, .2);
  --tint: #0a63d8;
  --tint-soft: rgba(10, 99, 216, .12);
  --green: #248a3d;
  --green-soft: rgba(52, 199, 89, .15);
  --orange: #c45500;
  --orange-soft: rgba(255, 149, 0, .15);
  --red: #e5352b;
  --yellow: #ffd60a;
  --bar: rgba(249, 249, 249, .82);
  --shadow: 0 8px 30px rgba(0, 0, 0, .12);
  --r: 12px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --card: #1c1c1e;
    --card2: #2c2c2e;
    --label: #fff;
    --label2: rgba(235, 235, 245, .6);
    --label3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .55);
    --fill: rgba(118, 118, 128, .24);
    --fill2: rgba(118, 118, 128, .32);
    --tint: #3d8bff;
    --tint-soft: rgba(61, 139, 255, .18);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, .18);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, .18);
    --red: #ff453a;
    --bar: rgba(22, 22, 24, .82);
    --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--tint); text-decoration: none; }
img { display: block; max-width: 100%; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
#app {
  max-width: 680px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
}
.nav {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px; padding: 10px 16px;
  min-height: 52px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
}
.nav h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .back, .nav .act { min-width: 72px; min-height: 44px; display: flex; align-items: center; gap: 2px; color: var(--tint); background: none; border: 0; padding: 0; cursor: pointer; }
.nav .act { justify-content: flex-end; }
.lt { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; margin: 18px 0 6px; }
.sub { color: var(--label2); margin: 0 0 18px; font-size: 15px; }
.muted { color: var(--label2); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- grouped list (inset) ---------- */
.gh { font-size: 13px; text-transform: uppercase; color: var(--label2); margin: 26px 16px 7px; letter-spacing: .02em; }
.gf { font-size: 13px; color: var(--label2); margin: 7px 16px 0; }
.group { background: var(--card); border-radius: var(--r); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 10px 16px;
  position: relative; width: 100%; text-align: left;
  background: none; border: 0; color: inherit;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.row .k { flex: 1; min-width: 0; }
.row .v { color: var(--label2); text-align: right; }
button.row, a.row { cursor: pointer; }
button.row:active, a.row:active { background: var(--fill); }
.row .chev { color: var(--label3); width: 16px; height: 16px; }
.row select, .row input[type=text], .row input[type=tel], .row textarea {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; text-align: right; color: var(--label2);
  -webkit-appearance: none; appearance: none; padding: 4px 0;
}
.row select { cursor: pointer; direction: rtl; }
.row select option { direction: ltr; }
.row textarea { text-align: left; resize: none; min-height: 84px; color: var(--label); }
.row input::placeholder, .row textarea::placeholder { color: var(--label3); }
.ico { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.ico svg.i { width: 18px; height: 18px; }

/* ---------- controls ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 0 20px;
  border-radius: 14px; border: 0; cursor: pointer;
  background: var(--tint); color: #fff; font-weight: 600;
  transition: transform .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.97); opacity: .85; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.gray { background: var(--fill); color: var(--tint); }
.btn.plain { background: var(--card); color: var(--label); }
.btn.danger { background: var(--fill); color: var(--red); }
.btn + .btn { margin-top: 10px; }
.btn svg { width: 20px; height: 20px; }

.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 7px 6px; border-radius: 7px;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: background .25s var(--ease), box-shadow .25s;
}
.seg input:checked + span { background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg input:focus-visible + span { outline: 2px solid var(--tint); }
@media (prefers-color-scheme: dark) { .seg input:checked + span { background: #636366; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border-radius: 19px; background: var(--card); font-size: 15px; cursor: pointer;
  border: 1px solid var(--sep);
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.chip span:active { transform: scale(.95); }
.chip input:checked + span { background: var(--tint); border-color: var(--tint); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--tint); outline-offset: 2px; }
.pad { padding: 14px 16px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile span {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px;
  min-height: 92px; border-radius: var(--r); background: var(--card); cursor: pointer;
  border: 2px solid transparent; font-weight: 600; font-size: 16px;
  transition: border-color .2s, transform .2s var(--ease);
}
.tile span svg { width: 28px; height: 28px; color: var(--tint); }
.tile span:active { transform: scale(.97); }
.tile input:checked + span { border-color: var(--tint); background: var(--tint-soft); }
.tile input:focus-visible + span { outline: 2px solid var(--tint); outline-offset: 2px; }

.sw { position: relative; width: 51px; height: 31px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; border-radius: 16px; background: var(--fill2); transition: background .25s; }
.sw span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16);
  transition: transform .3s var(--ease);
}
.sw input:checked + span { background: #34c759; }
.sw input:checked + span::after { transform: translateX(20px); }
.sw input:focus-visible + span { outline: 2px solid var(--tint); outline-offset: 2px; }

.stepper { display: flex; align-items: center; background: var(--fill); border-radius: 9px; }
.stepper button { width: 46px; height: 34px; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--label); }
.stepper b { min-width: 28px; text-align: center; font-weight: 600; }

/* ---------- search ---------- */
.searchbar {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 40px; padding: 0 10px; border-radius: 10px; border: 0;
  background: var(--fill); color: var(--label2); cursor: pointer; text-align: left; font-size: 17px;
}
.searchbar svg { width: 18px; height: 18px; }
.searchbar .q { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsum { display: flex; gap: 6px; overflow-x: auto; margin: 10px -16px 4px; padding: 0 16px; scrollbar-width: none; }
.fsum::-webkit-scrollbar { display: none; }
.pill { flex: none; font-size: 13px; padding: 5px 10px; border-radius: 14px; background: var(--fill); color: var(--label); white-space: nowrap; }

.list { display: grid; gap: 14px; margin-top: 14px; }
.card {
  display: block; background: var(--card); border-radius: 16px; overflow: hidden; color: inherit;
  transition: transform .25s var(--ease);
  content-visibility: auto; contain-intrinsic-size: 340px;
}
.card:active { transform: scale(.98); }
.card .ph { aspect-ratio: 16 / 10; background: var(--fill); position: relative; }
.card .ph.e { aspect-ratio: 16 / 5; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.card .ph .noph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--label3); }
.card .ph .noph svg { width: 44px; height: 44px; }
.card .bd { padding: 12px 14px 14px; }
.card h3 { margin: 0 0 2px; font-size: 17px; font-weight: 600; }
.card .loc { color: var(--label2); font-size: 15px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 13px; font-weight: 600; padding: 4px 9px; border-radius: 7px; background: var(--fill); }
.tag.free { background: var(--green-soft); color: var(--green); }
.tag.util { background: var(--orange-soft); color: var(--orange); }
.tag.hidden { background: rgba(229, 53, 43, .15); color: var(--red); }
.who { display: flex; gap: 10px; margin-top: 10px; color: var(--label2); }
.who svg { width: 18px; height: 18px; }
.who .no { opacity: .35; position: relative; }
.who .no::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; border-top: 1.6px solid var(--red); transform: rotate(-35deg); }

.empty { text-align: center; padding: 60px 20px; color: var(--label2); }
.empty svg { width: 56px; height: 56px; color: var(--label3); margin: 0 auto 12px; }
.empty h3 { color: var(--label); margin: 0 0 6px; font-size: 20px; }

/* ---------- detail ---------- */
.gal { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; scrollbar-width: none; background: var(--fill); }
.gal::-webkit-scrollbar { display: none; }
.gal img { flex: none; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; scroll-snap-align: center; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--label3); }
.dots i.on { background: var(--label); }
.dt { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 16px 0 2px; line-height: 1.15; }
.ok { color: var(--green); } .bad { color: var(--red); }
.note { white-space: pre-wrap; padding: 14px 16px; }
.actions { display: grid; gap: 10px; margin-top: 22px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.actions.two .btn + .btn { margin: 0; }

/* ---------- photos in form ---------- */
.phs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; }
.phs .p { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--fill); }
.phs .p img { width: 100%; height: 100%; object-fit: cover; }
.phs .p button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.phs .p button svg { width: 14px; height: 14px; stroke-width: 2.6; }
.phs .add { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed var(--label3); color: var(--tint); cursor: pointer; }
.phs .add input { display: none; }

/* ---------- chat ---------- */
.av { width: 44px; height: 44px; border-radius: 50%; background: var(--tint-soft); color: var(--tint); display: grid; place-items: center; font-weight: 600; flex: none; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.crow .k b { display: block; font-weight: 600; }
.crow .k span { display: block; color: var(--label2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .t { color: var(--label2); font-size: 14px; align-self: flex-start; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.msgs { display: flex; flex-direction: column; gap: 4px; padding: 14px 0 90px; }
.m { max-width: 78%; padding: 8px 13px; border-radius: 18px; background: var(--card); white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; animation: pop .3s var(--ease); }
.m.me { align-self: flex-end; background: var(--tint); color: #fff; }
.m small { display: block; font-size: 11px; opacity: .6; margin-top: 2px; text-align: right; }
.mday { align-self: center; font-size: 12px; color: var(--label2); margin: 10px 0 4px; }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.composer form { max-width: 680px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 120px; min-height: 38px; padding: 8px 14px; border-radius: 19px; border: .5px solid var(--sep); background: var(--card); outline: none; }
.composer button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--tint); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.composer button svg { width: 20px; height: 20px; stroke-width: 2.4; }
.chathead { font-size: 13px; text-align: center; color: var(--label2); padding: 8px; }

/* ---------- tab bar ---------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs nav { max-width: 680px; margin: 0 auto; display: flex; }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px; min-height: 50px; color: var(--label2); font-size: 10.5px; font-weight: 500; position: relative; }
#tabs a svg { width: 26px; height: 26px; }
#tabs a.on { color: var(--tint); }
#tabs .badge { position: absolute; top: 3px; left: calc(50% + 6px); }
body.nochrome #tabs { display: none; }

/* ---------- sheet / dialog ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .35s var(--ease); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 680px; margin: 0 auto; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  background: var(--bg); border-radius: 14px 14px 0 0;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .45s var(--ease);
  overscroll-behavior: contain;
}
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label3); margin: 6px auto 0; }
.sheet .nav { margin: 0 -16px; background: var(--bg); border-bottom: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.open .scrim { opacity: 1; }
.open .sheet { transform: none; }

.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 90;
  transform: translate(-50%, -150%); max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow);
  font-size: 15px; font-weight: 500; transition: transform .45s var(--ease);
}
.toast.on { transform: translate(-50%, 0); }

/* ---------- welcome ---------- */
.hero { padding: 36px 0 10px; }
.flag { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); margin-bottom: 18px; }
.flag i { flex: 1; } .flag i:first-child { background: #0057b7; } .flag i:last-child { background: #ffd700; }
.hero h1 { font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; margin: 0 0 10px; }
.hero p { font-size: 19px; color: var(--label2); margin: 0; }
.feat .ico { background: var(--tint); }
.feat .k b { display: block; font-weight: 600; }
.feat .k span { color: var(--label2); font-size: 15px; }
.auth { margin-top: 26px; }
.btn.g { background: var(--card); color: var(--label); border: .5px solid var(--sep); }
.btn.fb { background: #1877f2; }
.btn.tg { background: #2aabee; }
.why { margin-top: 16px; padding: 14px 16px; border-radius: var(--r); background: var(--tint-soft); font-size: 15px; }
.why b { display: block; margin-bottom: 4px; }

.big-ico { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; margin: 40px auto 18px; background: var(--tint-soft); color: var(--tint); }
.big-ico svg { width: 44px; height: 44px; }
.big-ico.red { background: rgba(229, 53, 43, .14); color: var(--red); }

.spin { width: 28px; height: 28px; margin: 60px auto; border-radius: 50%; border: 3px solid var(--fill2); border-top-color: var(--tint); animation: rot .8s linear infinite; }
.btn .spin { width: 20px; height: 20px; margin: 0; border-width: 2.5px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

@keyframes rot { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.view { animation: fade .35s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 700px) {
  .list { grid-template-columns: 1fr 1fr; }
  .lt { font-size: 40px; }
}

/* ---------- safety / trust ---------- */
.trust { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 13px; color: var(--label2); }
.trust svg.i { width: 15px; height: 15px; color: var(--green); }
.tag.newacc { background: var(--orange-soft); color: var(--orange); font-size: 12px; padding: 2px 7px; }
.why.bad-box { margin-top: 16px; background: rgba(229, 53, 43, .12); }
.why b svg.i { width: 17px; height: 17px; vertical-align: -3px; }
.why.tip { margin: 10px 0 0; font-size: 14px; }
.linkbtn { display: block; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--tint); font-weight: 600; cursor: pointer; min-height: 32px; }
.chathead { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.chathead .trust { margin: 0; }
.mwarn {
  align-self: flex-start; max-width: 86%; display: flex; gap: 8px; align-items: flex-start;
  margin: 2px 0 6px; padding: 8px 12px; border-radius: 12px;
  background: var(--orange-soft); color: var(--orange); font-size: 13px; font-weight: 500;
}
.mwarn svg.i { width: 17px; height: 17px; margin-top: 1px; }
.safety .row { font-size: 15px; }
.safety .row svg.i { width: 18px; height: 18px; }
.safety .row:nth-child(-n+2) svg.i { color: var(--red); }
.safety .row:nth-child(n+3) svg.i { color: var(--green); }
