/* ПИТ СТОП — стилови на апликацијата */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-text); outline-offset: 3px;
}

.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--carbon);
  overflow: hidden;
}

.screen { position: absolute; top: 0; right: 0; bottom: var(--tabbar-h); left: 0; overflow: hidden; }
.scroll { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: var(--s5) var(--s4) var(--s6); }

.hide-sb { scrollbar-width: none; }
.hide-sb::-webkit-scrollbar { display: none; }

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

/* ————— типографија ————— */
.h { font-family: var(--font-display); font-style: italic; font-weight: 900; text-transform: uppercase; }
.h1 { font-size: 34px; line-height: 1; margin: 0; }
.h2 { font-size: 20px; line-height: 1.05; margin: 0; }
.lbl { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-weight: 700; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }

/* ————— закосени елементи ————— */
.skew { transform: skewX(var(--skew)); }
.skew > span, .skew > .in { display: inline-flex; align-items: center; justify-content: center; gap: 6px; transform: skewX(var(--unskew)); }

.btn {
  height: 48px; padding: 0 20px; border: 0; background: var(--accent); color: var(--white);
  transform: skewX(var(--skew)); font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn > span { display: inline-flex; align-items: center; gap: 8px; transform: skewX(var(--unskew)); }
.btn:active { filter: brightness(.88); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; border: 1.5px solid var(--white); }
.btn--sm { height: 36px; padding: 0 14px; font-size: 11px; }
.btn--block { flex: 1 1 0; }

.tag {
  padding: 4px 10px; background: var(--accent); transform: skewX(var(--skew));
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  display: inline-flex;
}
.tag > span { transform: skewX(var(--unskew)); }
.tag--outline { background: transparent; border: 1.5px solid var(--white); padding: 2px 10px; }
.tag--ghost { background: var(--card); border: 1px solid var(--line-soft); }

/* ————— горна лента ————— */
.topbar {
  position: absolute; z-index: 4; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: var(--s3) var(--s3) var(--s2);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-bar { width: 10px; height: 24px; background: var(--accent); transform: skewX(-18deg); }
.brand-name { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 16px; letter-spacing: .02em; white-space: nowrap; }

.seg { display: flex; gap: 4px; }
.seg button {
  height: 30px; padding: 0 9px; border: 0; background: rgba(12, 12, 14, .66); color: var(--white);
  transform: skewX(var(--skew)); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  backdrop-filter: blur(10px);
}
.seg button > span { display: inline-block; transform: skewX(var(--unskew)); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--carbon); }

.region-btn {
  height: 30px; padding: 0 10px; border: 1px solid var(--line-soft); background: rgba(12, 12, 14, .66);
  color: var(--white); transform: skewX(var(--skew)); font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  backdrop-filter: blur(10px);
}
.region-btn > span { display: inline-flex; align-items: center; gap: 5px; transform: skewX(var(--unskew)); }

/* ————— фид ————— */
.feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; }
.post { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; }

.shots { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.shot {
  position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding-bottom: 180px; overflow: hidden;
}
.shot-num {
  position: absolute; top: 12%; right: -5%; font-family: var(--font-display); font-style: italic; font-weight: 900;
  font-size: 34vh; line-height: 1; letter-spacing: -.06em; color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, .12); pointer-events: none; user-select: none;
}
.shot-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
}
.shot > img, .result-thumb > img, .garage-photo > img, .gallery > div > img, .grid-tile > img, .portrait > img {
  width: 100%; height: 100%; object-fit: cover;
}
.portrait { overflow: hidden; }
.legal-review { padding: 14px; border: 1px solid var(--accent); background: var(--card); }
.legal-review strong { display: block; margin-bottom: 8px; color: var(--accent-text); font: 700 11px var(--font-mono); letter-spacing: .08em; }
.legal-review p { margin: 0; }
.shot > img, .gallery > div > img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.shot > img { z-index: 0; }
.gallery > div { position: relative; }
.badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 10px; background: var(--accent);
  color: #fff; font: 700 10px var(--font-mono); display: inline-flex; align-items: center; justify-content: center;
}
.scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58%;
  background: linear-gradient(to top, var(--carbon) 0%, rgba(12, 12, 14, .92) 42%, rgba(12, 12, 14, 0) 100%);
  pointer-events: none;
}

.bars { position: absolute; z-index: 3; top: 56px; left: 14px; right: 14px; display: flex; gap: 4px; pointer-events: none; }
.bars span { flex: 1 1 0; height: 3px; background: rgba(255, 255, 255, .22); transform: skewX(-20deg); }
.bars span.seen { background: rgba(255, 255, 255, .6); }
.bars span.now { background: var(--white); }
.counter {
  position: absolute; z-index: 3; top: 66px; right: 14px; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: rgba(255, 255, 255, .85); pointer-events: none;
}

.rail { position: absolute; z-index: 3; right: 10px; bottom: 300px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rail-btn { width: 48px; height: 44px; border: 0; background: transparent; color: var(--white); display: flex; align-items: center; justify-content: center; }
.rail-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rail-item span { font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.avatar-btn {
  width: 50px; height: 50px; border: 2px solid var(--white); border-radius: 999px; background: var(--card); color: var(--white);
  font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 15px;
}
.rail-btn.on svg { color: var(--accent); }

.hud { position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.hud-top { display: flex; align-items: center; gap: 8px; padding-right: 60px; flex-wrap: wrap; }
.hud-title { display: flex; align-items: flex-end; gap: 10px; padding: 0 60px 0 0; background: none; border: 0; text-align: left; }
.num-plate {
  min-width: 46px; height: 46px; padding: 0 6px; background: var(--white); color: var(--carbon); transform: skewX(var(--skew));
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.num-plate > span { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 26px; transform: skewX(var(--unskew)); }
.hud-name { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 26px; line-height: .98; text-transform: uppercase; color: var(--white); }

.tele { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tele div { padding: 8px 0 8px 10px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.tele div:first-child { border-left: 0; }
.tele b { font-family: var(--font-display); font-weight: 800; font-size: 17px; font-style: normal; }

.price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 34px; line-height: 1; }
.caption { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-soft); }

/* ————— долно мени ————— */
.tabbar {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  display: flex; align-items: center; justify-content: space-between; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--carbon);
}
.tabbar::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background-image: conic-gradient(#FFF 25%, var(--carbon) 0 50%, #FFF 0 75%, var(--carbon) 0); background-size: 6px 6px; opacity: .9;
}
.tab {
  flex: 1 1 0; height: 52px; border: 0; background: transparent; color: #8A8A93;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.tab .ul { width: 18px; height: 3px; background: transparent; transform: skewX(-20deg); }
.tab[aria-current="page"] { color: var(--white); }
.tab[aria-current="page"] .ul { background: var(--accent); }
.tab-add { flex: 0 0 auto; width: 58px; height: 42px; border: 0; background: var(--accent); color: var(--white); transform: skewX(var(--skew)); display: flex; align-items: center; justify-content: center; }
.tab-add svg { transform: skewX(var(--unskew)); }

/* ————— барање ————— */
.field {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px;
  background: var(--card); border-bottom: 2px solid var(--accent);
}
.field input { flex: 1 1 0; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; font-weight: 600; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; }
.chip {
  flex: 0 0 auto; height: 32px; padding: 0 12px; border: 1px solid var(--line-soft); background: var(--card); color: var(--white);
  transform: skewX(var(--skew)); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.chip > span { display: inline-block; transform: skewX(var(--unskew)); }
.chip[aria-pressed="true"] { background: var(--white); color: var(--carbon); border-color: var(--white); }

.result { display: flex; align-items: stretch; width: 100%; padding: 0; border: 0; border-left: 3px solid var(--accent); background: var(--card); color: var(--white); text-align: left; }
.result-thumb { position: relative; flex: 0 0 132px; height: 100px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.result-thumb .n {
  position: absolute; right: -4px; bottom: -14px; font-family: var(--font-display); font-style: italic; font-weight: 900;
  font-size: 72px; color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .18);
}
.result-body { flex: 1 1 0; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.result-name { font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 16px; text-transform: uppercase; line-height: 1.05; }
.empty { padding: 40px 0; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ————— топ листа ————— */
.rank { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-left: 3px solid var(--line-soft); background: var(--card); color: var(--white); text-align: left; }
.rank .pos { width: 40px; height: 40px; flex: 0 0 auto; transform: skewX(var(--skew)); border: 1.5px solid var(--white); display: flex; align-items: center; justify-content: center; }
.rank .pos > span { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 16px; transform: skewX(var(--unskew)); }
.rank.p1 { border-left-color: var(--accent); }
.rank.p1 .pos { background: var(--accent); border-color: var(--accent); }
.rank.p2 .pos { background: var(--white); color: var(--carbon); }
.rank-body { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rank-name { font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 15px; text-transform: uppercase; }

/* ————— пораки ————— */
.msg { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--white); text-align: left; }
.msg .av { flex: 0 0 48px; height: 48px; border: 1.5px solid var(--line-soft); border-radius: 999px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-style: italic; font-weight: 800; }
.msg.unread .av { border-color: var(--accent); }

/* ————— профил ————— */
.licence { position: relative; overflow: hidden; padding: 16px; background: var(--card); border: 1px solid var(--line); }
.licence::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background-image: repeating-linear-gradient(90deg, #FFF 0 5px, var(--card) 5px 10px); }
.licence .ghost { position: absolute; right: -6px; bottom: -40px; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 140px; color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, .1); }
.portrait { flex: 0 0 72px; height: 86px; background: #26262B; border: 1.5px solid var(--white); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 26px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.stats div { padding: 10px 0 0 10px; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.stats div:first-child { border-left: 0; padding-left: 0; }
.stats b { font-family: var(--font-display); font-weight: 800; font-size: 22px; font-style: normal; }

.garage { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; }
.garage-card { flex: 0 0 240px; background: var(--card); border-top: 3px solid var(--accent); }
.garage-card.show { border-top-color: var(--white); }
.garage-photo { position: relative; height: 118px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.garage-photo .n { position: absolute; right: 4px; bottom: -22px; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 96px; color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, .16); }

.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.grid-tile { position: relative; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; border: 0; padding: 0; color: var(--white); }
.grid-tile .n { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 42px; color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, .3); }
.grid-tile .likes { position: absolute; left: 6px; bottom: 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; display: flex; align-items: center; gap: 3px; }

/* ————— листови (детали, нов пост, регион) ————— */
#overlay:empty { display: none; }
.sheet-wrap { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; display: flex; justify-content: center; }
.sheet-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border: 0; background: rgba(0, 0, 0, .7); }
.sheet {
  position: relative; align-self: flex-end; width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh;
  background: var(--panel); border-top: 3px solid var(--accent); display: flex; flex-direction: column; overflow: hidden;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { display: flex; gap: 12px; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--carbon); }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line-soft); background: transparent; color: var(--white); display: flex; align-items: center; justify-content: center; }

.gallery { flex: 0 0 auto; display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px; }
.gallery > div { flex: 0 0 82%; height: 190px; min-height: 190px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow: hidden; }

.spec { display: flex; align-items: baseline; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.spec .dots { flex: 1 1 0; border-bottom: 1px dotted var(--line-soft); transform: translateY(-3px); }
.spec b { font-family: var(--font-display); font-weight: 800; font-size: 16px; font-style: normal; }
.mod { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card-2); border-left: 3px solid var(--accent); font-size: 15px; font-weight: 600; }
.seller { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card-2); }
.seller .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seller .av { flex: 0 0 46px; height: 46px; border: 1.5px solid var(--white); border-radius: 999px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-style: italic; font-weight: 800; }
.verified { padding: 1px 6px; background: var(--white); color: var(--carbon); font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .1em; }

/* форма */
.form-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; border-bottom: 1px solid var(--line); }
.form-row > span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.form-row input, .form-row select { width: 55%; border: 0; outline: none; background: transparent; font-size: 15px; font-weight: 700; text-align: right; }
.form-row select { text-align-last: right; padding-right: 2px; }
textarea {
  width: 100%; border: 1px solid var(--line-soft); outline: none; background: var(--card-2); color: var(--white);
  padding: 12px; font-size: 15px; resize: vertical; min-height: 96px;
}
.kind-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kind-switch button { height: 44px; border: 1.5px solid var(--line-soft); background: transparent; color: var(--white); transform: skewX(var(--skew)); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.kind-switch button > span { display: inline-block; transform: skewX(var(--unskew)); }
.kind-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.kind-switch button.show[aria-pressed="true"] { background: var(--white); border-color: var(--white); color: var(--carbon); }
.photo-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-slots button { aspect-ratio: 1; border: 1.5px dashed var(--white); background: var(--card-2); color: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.photo-slots .slot { aspect-ratio: 1; border: 1px dashed var(--line-soft); display: flex; align-items: center; justify-content: center; }
.photo-slots .slot.filled { border-style: solid; }
.photo-slots .slot { min-width: 0; overflow: hidden; padding: 6px; color: var(--text-soft); font-size: 10px; text-align: center; overflow-wrap: anywhere; }
.photo-management { display: flex; flex-direction: column; gap: 8px; }
.photo-management-item { display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 6px; background: var(--card); border: 1px solid var(--line); }
.photo-management-item > img { width: 72px; height: 48px; object-fit: cover; background: var(--card-2); }
.photo-management-item > .lbl { flex: 1; }
.photo-management-actions { display: flex; gap: 4px; }
.photo-management-actions .icon-btn { width: 34px; height: 34px; }
.photo-management-actions [data-act="photo-up"] svg { transform: rotate(-90deg); }
.photo-management-actions [data-act="photo-down"] svg { transform: rotate(90deg); }
.photo-management-actions .photo-remove { color: var(--accent-text); }
.photo-management-actions button:disabled { opacity: .35; cursor: not-allowed; }

.region-list { display: flex; flex-direction: column; gap: 8px; }
.region-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px 12px; border: 0; border-left: 3px solid var(--line-soft); background: var(--card); color: var(--white); text-align: left; }
.region-item[aria-pressed="true"] { border-left-color: var(--accent); }
.region-item b { font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 16px; text-transform: uppercase; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 84px); transform: translateX(-50%) skewX(var(--skew));
  z-index: 30; padding: 10px 16px; background: var(--white); color: var(--carbon);
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.toast > span { display: inline-block; transform: skewX(var(--unskew)); }

.rowspread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.gap2 { gap: var(--s2); } .gap3 { gap: var(--s3); } .gap4 { gap: var(--s4); } .gap5 { gap: var(--s5); }

@media (max-width: 359px) {
  .brand-name { display: none; }
  .hud-name { font-size: 22px; }
  .hud { left: 12px; right: 12px; }
  .rail { right: 4px; }
}

@media (min-width: 481px) {
  body { display: flex; align-items: center; justify-content: center; }
  .app { height: min(920px, 100vh); height: min(920px, 100dvh); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* portrait tablets: retain the cockpit, give controls a little more air */
@media (min-width: 481px) and (max-width: 959px) {
  .app { max-width: 720px; }
  .h1 { font-size: 38px; }
  .tab { font-size: 11px; }
  .tabbar { padding-left: 20px; padding-right: 20px; }
  .btn, .region-btn, .icon-btn { min-height: 48px; }
}

/* desktop cockpit: the phone navigation becomes a fixed race-control rail */
.sidebar { display: none; }
.listing-nav, .photo-nav { display: none; }

@media (min-width: 960px) {
  html, body { min-height: 100%; background: var(--carbon); }
  body { display: block; overflow: hidden; }
  .app { width: 100%; max-width: none; height: 100vh; height: 100dvh; margin: 0; border: 0; }
  .sidebar {
    position: fixed; z-index: 10; top: 0; right: auto; bottom: 0; left: 0; width: 238px;
    display: flex; flex-direction: column; background: var(--panel);
    border-right: 1px solid var(--line); padding: 30px 20px 24px;
  }
  .sidebar .brand { margin: 0 10px 54px; }
  .sidebar .brand-name { font-size: 22px; }
  .sidebar .brand-bar { height: 30px; width: 12px; }
  .side-nav { display: flex; flex-direction: column; gap: 7px; }
  .side-nav button {
    position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
    min-height: 52px; padding: 0 16px; border: 0; background: transparent;
    color: var(--text-muted); text-align: left; font-family: var(--font-display);
    font-style: italic; font-weight: 900; font-size: 15px; text-transform: uppercase;
  }
  .side-nav button::before {
    content: ""; width: 5px; height: 28px; position: absolute; left: 0;
    background: transparent; transform: skewX(-12deg);
  }
  .side-nav button[aria-current="page"] { color: var(--white); background: var(--card); }
  .side-nav button[aria-current="page"]::before { background: var(--accent); }
  .side-nav .side-add { margin-top: 22px; background: var(--accent); color: var(--white); }
  .side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 10px 0; }
  .screen { top: 0; right: 0; bottom: 0; left: 238px; }
  .tabbar { display: none; }
  .topbar { left: 28px; right: 28px; padding-top: 24px; }
  .topbar .brand { visibility: hidden; }
  .feed { padding: 0 32px; }
  .post { max-width: 1120px; margin: 0 auto; }
  .shots {
    top: 82px; right: 0; bottom: 242px; left: 0; width: min(66vw, 820px); height: auto; left: 50%;
    right: auto; transform: translateX(-50%); background: var(--carbon);
  }
  .shot { padding-bottom: 0; }
  .shot svg { max-width: min(70%, 560px); max-height: 50%; }
  .scrim { bottom: 0; height: 48%; }
  .hud { left: 0; right: 0; bottom: 34px; max-width: 1120px; margin: 0 auto; padding: 0 8px; }
  .hud-title { min-width: 0; max-width: 100%; }
  .hud-name { min-width: 0; max-width: min(52vw, 700px); overflow-wrap: anywhere; }
  .listing-nav, .photo-nav { display: flex; position: absolute; z-index: 5; gap: 8px; }
  .listing-nav {
    left: calc((100% - min(66vw, 820px)) / 2 + 10px);
    top: 50%; transform: translateY(-50%); flex-direction: column;
  }
  .photo-nav {
    right: calc((100% - min(66vw, 820px)) / 2 + 10px);
    top: 50%; transform: translateY(-50%); flex-direction: column;
  }
  .listing-nav button, .photo-nav button {
    width: 44px; height: 44px; border: 1px solid var(--line-soft);
    background: rgba(12,12,14,.82); color: var(--white);
  }
  .photo-nav button:first-child svg { transform: rotate(180deg); }
  .listing-nav button:first-child svg { transform: rotate(-90deg); }
  .listing-nav button:last-child svg { transform: rotate(90deg); }
  .pad { max-width: 1180px; margin: 0 auto; padding: 34px 46px 54px; }
  .result { min-height: 190px; display: block; }
  .result-thumb { width: 100%; height: 132px; }
  .result-body { min-height: 112px; padding: 12px 14px; }
  .sheet-wrap { align-items: center; }
  .sheet { align-self: center; width: min(720px, calc(100% - 48px)); max-width: 920px; max-height: 88vh; max-height: 88dvh; border: 1px solid var(--line); border-top: 4px solid var(--accent); }
  .sheet-body { padding: 20px 24px 26px; }
  .sheet-foot { padding: 14px 24px 18px; }
  .gallery > div { height: 230px; min-height: 230px; }
}

@media (min-width: 960px) and (max-height: 700px) {
  .sidebar .brand { margin-bottom: 24px; }
  .shots { top: 70px; bottom: 205px; }
  .hud { bottom: 18px; }
  .hud .caption { display: none; }
  .rail { top: 72px; bottom: auto; gap: 5px; }
  .rail-btn { width: 38px; height: 34px; }
  .avatar-btn { width: 42px; height: 42px; }
}

@media (min-width: 960px) {
  .col.gap3:has(.result) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .col.gap3:has(.result) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .col.gap3:has(.result) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (orientation: landscape) and (max-width: 959px) {
  .app { max-width: 100vw; }
  .shot { padding-bottom: 120px; }
  .hud { bottom: 10px; }
  .rail { top: 54px; bottom: auto; gap: 3px; }
  .rail-btn { width: 38px; height: 32px; }
  .avatar-btn { width: 40px; height: 40px; font-size: 13px; }
  .bars { top: 44px; }
}

/* --- Supabase верзија: аватари, пораки, избрани фотографии --- */
.avatar-btn, .msg .av, .seller .av { overflow: hidden; }
.avatar-btn > img, .msg .av > img, .seller .av > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-msg { margin-bottom: 8px; max-width: 86%; }
.chat-msg.mine { margin-left: auto; border-left: 0; border-right: 3px solid var(--accent); background: var(--card); }
.chat-msg .lbl { font-size: 10px; }
.photo-slots .slot { position: relative; }
.photo-slots .slot .icon-btn { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; background: rgba(0,0,0,.6); }
.form-row input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--accent); }
.side-foot { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.dialog-wrap { z-index: 25; }
.dialog-wrap .sheet { max-width: 440px; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dialog-actions .btn { flex: 1 1 140px; }
.dialog textarea { min-height: 96px; }
.demo-tag { margin-left: 10px; }
.demo-note { display: flex; flex-direction: column; gap: 10px; }
.demo-note p { margin: 0; }
.demo-note .btn { align-self: flex-start; }
@media (max-width: 520px) { .demo-tag { display: none; } }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.price-note { margin-left: 8px; font-size: .45em; font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--text-soft); vertical-align: middle; }
.comment { align-items: flex-start; }
.comment-body { overflow-wrap: anywhere; }
.comment-del { width: 28px; height: 28px; flex: 0 0 28px; }
.caption, .soft, .mod { overflow-wrap: anywhere; }
#message-form { display: flex; gap: 8px; align-items: center; }
#message-form input { flex: 1 1 auto; min-width: 0; }
#message-form .btn { flex: 0 0 auto; }
/* Помали телефони (пониски од 740px): страничните копчиња се збиваат да не одат под горното мени */
@media (max-width: 959px) and (orientation: portrait) and (max-height: 740px) {
  .rail { top: 82px; bottom: auto; gap: 2px; }
  .rail-btn { width: 40px; height: 34px; }
  .rail .avatar-btn { width: 38px; height: 38px; font-size: 12px; }
  .rail-item span { font-size: 10px; }
}

/* =====================================================================
   МОБИЛНИ ПОПРАВКИ
   ===================================================================== */
/* Постари прелистувачи без dvh: висината ја пресметува JS (--app-h) */
@supports not (height: 1dvh) {
  .app { height: var(--app-h, 100vh); }
  .sheet { max-height: calc(var(--app-h, 100vh) * .92); }
  @media (min-width: 481px) and (max-width: 959px) { .app { height: min(920px, var(--app-h, 100vh)); } }
  @media (min-width: 960px) { .app { height: var(--app-h, 100vh); } }
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, a, input, select, textarea, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* iPhone не зумира кога полето има најмалку 16px текст */
.form-row input, .form-row select, textarea, #message-form input, .field input { font-size: 16px; }

/* Поле за порака */
#message-form input {
  height: 46px; padding: 0 14px; border: 1px solid var(--line-soft); background: var(--card-2);
  color: var(--white); outline: none; border-radius: 0;
}
#message-form input:focus { border-color: var(--accent); }

/* Безбедни зони (notch / home линија / инсталирана апликација) */
.topbar { padding-top: calc(var(--s3) + env(safe-area-inset-top, 0px)); padding-left: max(var(--s3), env(safe-area-inset-left, 0px)); padding-right: max(var(--s3), env(safe-area-inset-right, 0px)); }
.bars { top: calc(56px + env(safe-area-inset-top, 0px)); }
.counter { top: calc(66px + env(safe-area-inset-top, 0px)); }
.pad { padding-top: calc(var(--s5) + env(safe-area-inset-top, 0px)); padding-left: max(var(--s4), env(safe-area-inset-left, 0px)); padding-right: max(var(--s4), env(safe-area-inset-right, 0px)); }
.hud { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }
.rail { right: max(10px, env(safe-area-inset-right, 0px)); }
.toast { max-width: calc(100vw - 32px); text-align: center; }

/* Долгиот опис во фидот не ги прекрива копчињата */
.hud .caption { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hud-name { overflow-wrap: anywhere; }

/* Тесни телефони (до 400px) */
@media (max-width: 400px) {
  .h1 { font-size: 30px; }
  .price { font-size: 28px; }
  .hud-name { font-size: 22px; }
  .num-plate { min-width: 40px; height: 40px; }
  .num-plate > span { font-size: 22px; }
  .tele b { font-size: 15px; }
  .tele div { padding-left: 8px; }
  .seg button { padding: 0 7px; font-size: 10px; }
  .result-thumb { flex-basis: 112px; }
  .garage-card { flex-basis: 210px; }
  .form-row > span { font-size: 10px; letter-spacing: .08em; }
  .form-row input, .form-row select { width: 58%; }
  .sheet-head { padding: 10px 12px; }
  .sheet-body { padding: 12px 12px 18px; }
  .sheet-foot { padding-left: 12px; padding-right: 12px; }
  .btn { padding: 0 14px; letter-spacing: .06em; }
  .stats b { font-size: 19px; }
}

/* Копчиња на профил — се прелеваат во нов ред на тесни екрани */
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-actions .btn { flex: 1 1 130px; min-width: 0; white-space: nowrap; }
.profile-actions .btn--sm { flex: 0 1 auto; }
@media (max-width: 400px) { .profile-actions .btn { font-size: 12px; letter-spacing: .05em; padding: 0 10px; } }
/* Ознаките во деталите не се развлекуваат */
.sheet-body .col > .tag { align-self: flex-start; max-width: 100%; }
.sheet-body .col > .tag > span { white-space: normal; }
/* Пребарување: полето се собира, копчето за филтри секогаш останува видливо */
.field { min-width: 0; }
.field + .btn { flex: 0 0 56px; width: 56px; min-width: 56px; }
/* Копчињата не смеат да се соберат во колона (overflow:hidden го брише автоматскиот минимум) */
.btn { min-height: 48px; }
.btn--sm { min-height: 36px; }

/* ————— Фид: цела фотографија (без сечење) врз заматена позадина од истата слика ————— */
.shot.has-photo { background: var(--carbon) !important; }
.shot.has-photo::before, .shot.has-photo::after { display: none; }
.shot > img.shot-bg {
  object-fit: cover; filter: blur(22px) brightness(.5) saturate(1.15);
  transform: scale(1.15); z-index: 0;
}
.shot > img.shot-fg { object-fit: contain; object-position: 50% 38%; z-index: 1; }
@media (min-width: 960px) {
  .shot > img.shot-fg { object-position: 50% 50%; }
}
.scrim { z-index: 2; }

/* ————— Пораки ————— */
.conv-head { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; background: none; border: 0; color: inherit; text-align: left; padding: 0; cursor: pointer; }
.conv-head .av { width: 40px; height: 40px; flex: 0 0 40px; }
.conv-head .col { min-width: 0; }
.conv-head b, .conv-head .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }
.conv-car { background: none; border: 0; padding: 0; color: var(--accent-text); font: 700 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; text-align: left; }
.msg .rank-body { min-width: 0; }
.msg .soft { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.msg.unread b::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
.tab { position: relative; }
.top-link { display: inline-flex; align-items: center; gap: 6px; }

/* ————— Потврдена е-пошта ————— */
.verify-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 18px 4px 6px; }
.verify-badge { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 0 0 8px rgba(224, 18, 26, .18); }
.verify-badge.fail { background: var(--card-2); box-shadow: 0 0 0 8px rgba(255, 255, 255, .06); }
.verify-hero .h { font-size: 24px; }
.verify-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 8px; }

/* ---- Каталог / филтри како салон ---- */
.seg-opt { flex: 1; position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: flex; align-items: center; justify-content: center; height: 40px; padding: 0 10px; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.seg-opt input:checked + span { background: var(--white); color: var(--carbon); border-color: var(--white); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.range2 { display: flex; gap: 8px; width: 58%; justify-content: flex-end; }
.range2 select { width: 50% !important; min-width: 0; }
.form-row select:disabled { color: var(--text-muted); opacity: .7; }
.form-row em { font-style: normal; text-transform: none; letter-spacing: 0; }
.form-row select option, .form-row select optgroup { background: var(--carbon, #0C0C0E); color: var(--white, #fff); }
.active-filters .chip span { white-space: nowrap; }
@media (max-width: 400px) { .range2 { width: 62%; gap: 6px; } .range2 select { font-size: 14px; } }

/* Порака по потврда на е-пошта (над формата за најава) */
.verify-pop { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 14px 20px; margin-bottom: 16px; border: 1px solid rgba(31, 191, 106, .45); background: rgba(31, 191, 106, .08); animation: verifyPop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.verify-pop .verify-badge { width: 56px; height: 56px; }
.verify-pop .h { font-size: 22px; }
.verify-pop .caption { margin: 0; max-width: 34ch; }
@keyframes verifyPop { from { opacity: 0; transform: translateY(-10px) scale(.94); } }
/* Предупредување кога нема избрано слика */
.photo-slots.need-photo > label { outline: 2px solid var(--red, #E10600); outline-offset: 3px; animation: needPhoto .5s ease 2; }
@keyframes needPhoto { 50% { transform: translateX(4px); } }
.verify-pop .verify-badge { background: #1FBF6A; box-shadow: 0 0 0 7px rgba(31, 191, 106, .2); }
