/* Табыл — мобильный в первую очередь */
:root {
  --bg: #f4f4ee;
  --surface: #ffffff;
  --ink: #14201b;
  --muted: #5d6862;
  --line: #e2e4dc;
  --dark: #14201b;
  --accent: #d4f05c;
  --accent-ink: #14201b;
  --lost: #c2551c;
  --found: #2f7d4f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 32, 27, .06), 0 6px 20px rgba(20, 32, 27, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px 32px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 3.5vw, 1.6rem); }
p { line-height: 1.5; }
a { color: inherit; }
img, video { max-width: 100%; display: block; }
.muted { color: var(--muted); }
small { color: var(--muted); font-weight: 400; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- кнопки ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; background: none; color: inherit;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); border-color: var(--line); }
.btn-outline-light { border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-link { padding: 0 4px; min-height: 36px; color: var(--muted); text-decoration: underline; font-weight: 500; }
.btn-lg { min-height: 54px; font-size: 1.05rem; padding: 0 24px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .92rem; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .06); font-size: 1rem; cursor: pointer; }

/* ---- шапка ---- */
.header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(244, 244, 238, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--dark); color: var(--accent); display: grid; place-items: center; font-size: 1.1rem; }
.city-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-link { font-size: .92rem; text-decoration: none; color: var(--muted); }
.fab { display: none; }
@media (max-width: 560px) {
  .nav-link, .nav-add { display: none; }
  .fab { display: inline-flex; position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); min-height: 52px; padding: 0 20px; border-radius: 999px; box-shadow: 0 8px 24px rgba(20, 32, 27, .25); z-index: 20; }
  body:has(.wizard) .fab, body:has(.done) .fab, body:has(.poster) .fab, body:has(.cabinet) .fab, body:has(.admin) .fab { display: none; }
}

/* ---- главная ---- */
.hero { margin: 16px 0 28px; padding: 28px 22px; border-radius: 24px; background: var(--dark); color: #fff; }
.hero h1 { font-size: clamp(2rem, 8vw, 3.4rem); font-weight: 600; letter-spacing: -.02em; }
.hero h1 span { color: var(--accent); }
.hero-sub { color: rgba(255, 255, 255, .78); max-width: 34em; margin-bottom: 22px; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 420px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--muted); margin: 0 0 10px; }
.hero .eyebrow { color: var(--accent); }

.feed-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.feed-head p { margin: 0 0 10px; font-size: .9rem; }
.search input {
  width: 100%; min-height: 50px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px;
  font: inherit; font-size: 1rem; background: var(--surface);
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.filters select { flex: 1 1 140px; }
select, input, textarea {
  min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; font-size: 16px; color: var(--ink); width: 100%;
}
textarea { padding: 12px; min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible { outline: 3px solid rgba(212, 240, 92, .9); outline-offset: 1px; }

.seg { display: inline-flex; background: #e9eae2; border-radius: 12px; padding: 3px; gap: 3px; }
.seg-btn { border: 0; background: none; padding: 0 14px; min-height: 40px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-lg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-bottom: 18px; }
.seg-lg .seg-btn { min-height: 52px; font-size: 1rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s; }
.card:hover { transform: translateY(-2px); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: #eceee6; display: grid; place-items: center; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-icon { font-size: 3rem; }
.badge { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; }
.badge.lost { background: var(--lost); }
.badge.found { background: var(--found); }
.badge.video { left: auto; right: 10px; background: rgba(0, 0, 0, .6); }
.my-list .badge { position: static; }
.card-body { padding: 12px 14px 14px; }
.card-meta { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.card-desc { margin: 0 0 8px; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-where { font-size: .85rem; }
.org-badge { display: inline-block; margin-top: 6px; font-size: .8rem; font-weight: 600; color: var(--found); }

@media (max-width: 560px) {
  /* на телефоне — компактные карточки в строку: больше объявлений на экране */
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card { flex-direction: row; }
  .card-media { flex: none; width: 112px; aspect-ratio: auto; min-height: 112px; }
  .card-icon { font-size: 2.2rem; }
  .badge { top: 6px; left: 6px; font-size: .7rem; padding: 3px 8px; }
  .badge.video { top: auto; bottom: 6px; right: 6px; }
  .card-body { padding: 10px 12px; min-width: 0; }
  .card h3 { font-size: 1rem; }
}
.loading { padding: 40px 0; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.empty { grid-column: 1 / -1; text-align: center; padding: 36px 16px; background: var(--surface); border-radius: var(--radius); }
.empty-icon { font-size: 2.4rem; margin: 0; }
.more { text-align: center; margin: 18px 0; }

.how { margin: 40px 0; }
.steps { padding: 0; margin: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps li { counter-increment: s; background: var(--surface); padding: 16px; border-radius: var(--radius); line-height: 1.5; }
.steps li::before { content: "0" counter(s); display: block; font-weight: 800; color: var(--found); margin-bottom: 6px; }

.org-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 22px; border-radius: 20px; background: #e6ecd0; margin-bottom: 20px; }
.org-cta p { margin: 0; max-width: 36em; }

/* ---- страницы ---- */
.page { max-width: 680px; margin: 20px auto; }
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; }
.listing-media { display: grid; gap: 10px; margin-bottom: 16px; }
.listing-media img, .listing-media video { width: 100%; max-height: 70vh; object-fit: contain; background: #e9eae2; border-radius: var(--radius); }
.listing-kind { font-weight: 700; margin: 0 0 6px; }
.listing-kind.lost { color: var(--lost); }
.listing-kind.found { color: var(--found); }
.listing-where { color: var(--muted); }
.listing-desc { white-space: pre-wrap; font-size: 1.05rem; }
.contact-box { margin: 18px 0 12px; }
.notice { padding: 14px 16px; border-radius: 14px; background: #fff7df; font-size: .92rem; line-height: 1.5; margin: 12px 0; }
.notice.ok { background: #e6f3e8; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { font-size: .85rem; }

/* ---- мастер формы ---- */
.wizard { padding-bottom: 90px; }
.wiz-top { display: flex; justify-content: space-between; align-items: center; }
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0 8px; }
.progress span { height: 5px; border-radius: 3px; background: var(--line); }
.progress span.on { background: var(--found); }
.step-label { font-size: .85rem; color: var(--muted); margin: 0 0 16px; }
.field { display: block; margin-bottom: 16px; }
.field > span, .field-title { display: block; font-weight: 600; margin-bottom: 6px; }
.help { display: block; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.hint-auto { font-style: normal; font-weight: 500; font-size: .78rem; color: var(--found); background: #e6f3e8; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 14px; min-height: 40px; font: inherit; font-size: .92rem; cursor: pointer; }
.chip.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.prefix b { padding: 0 4px 0 12px; color: var(--muted); font-weight: 600; }
.prefix input { border: 0; padding-left: 4px; }
.prefix:focus-within { outline: 3px solid rgba(212, 240, 92, .9); }
.prefix input:focus { outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 4px; line-height: 1.4; font-size: .95rem; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--found); }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.pick-btn { display: grid; place-items: center; min-height: 96px; border: 2px dashed #c9ccbf; border-radius: var(--radius); background: var(--surface); font-weight: 600; cursor: pointer; text-align: center; padding: 8px; }
.pick-btn:active { background: #f0f2e8; }
.preview { position: relative; margin-bottom: 18px; }
.preview img, .preview video { width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--radius); background: #e9eae2; }
.preview .icon-btn { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, .9); }
.wiz-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: space-between; gap: 10px;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(244, 244, 238, .96); border-top: 1px solid var(--line);
}
.wiz-nav .btn-accent { flex: 1; max-width: 360px; margin-left: auto; }
@media (min-width: 720px) {
  .wiz-nav { position: static; padding: 8px 0 0; background: none; border: 0; }
  .wizard { padding-bottom: 20px; }
}
.form-error { color: #b3261e; font-weight: 600; min-height: 1.2em; }
.done { text-align: center; }
.done .grid, .done .notice { text-align: left; }
.done-icon { font-size: 3rem; margin: 0; }
.done .row-actions { justify-content: center; }

/* ---- организации ---- */
.benefits { padding-left: 1.1em; line-height: 1.6; margin-bottom: 28px; }
.benefits li { margin-bottom: 6px; }
.my-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.my-list a { display: flex; gap: 10px; align-items: center; padding: 14px; background: var(--surface); border-radius: 12px; text-decoration: none; }

/* ---- кабинет организации ---- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 24px; }
.stats div { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stats b { display: block; font-size: 1.8rem; }
.stats span { color: var(--muted); font-size: .9rem; }
.quick, .card-form { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 24px; }
.quick .cat-chips { margin: -6px 0 16px; }
.quick .chip { min-height: 34px; font-size: .85rem; padding: 0 10px; }
details { margin: 4px 0 16px; }
summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 6px 0; }
.org-items { display: grid; gap: 8px; margin: 14px 0; }
.org-item { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: 14px; padding: 10px; }
.org-item img, .org-item-icon { width: 64px; height: 64px; flex: none; border-radius: 10px; object-fit: cover; background: #eceee6; display: grid; place-items: center; font-size: 1.8rem; }
.org-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.org-item-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-item-body .muted { font-size: .85rem; }
.org-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.small-print { font-size: .85rem; margin-top: 24px; }
.org-page { max-width: 1080px; margin: 16px auto; }
.org-hero { background: var(--dark); color: #fff; border-radius: 24px; padding: 24px 22px; margin-bottom: 22px; }
.org-hero .eyebrow { color: var(--accent); }
.org-hero .muted { color: rgba(255, 255, 255, .7); }
.org-badge a { color: inherit; }
.admin-card { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.admin-card p { margin: 6px 0; font-size: .92rem; }
.admin-card select { width: auto; min-height: 38px; }

/* ---- QR-плакат (печать А4) ---- */
.poster { background: #fff; border: 2px solid var(--dark); border-radius: 24px; padding: 32px 24px; text-align: center; max-width: 560px; margin: 0 auto; }
.poster-top { font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.poster h1 { font-size: 2.6rem; margin-bottom: 8px; }
.poster-sub { font-size: 1.15rem; margin: 0 0 18px; }
.poster-qr svg { width: min(320px, 70vw); height: auto; }
.poster-url { font-weight: 700; font-size: 1.1rem; margin: 8px 0; }
.poster-addr { margin: 6px 0; }
.poster-brand { margin: 18px 0 0; font-weight: 800; }
@media print {
  .header, .footer, .fab, .no-print, #toast { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .page { margin: 0 auto; }
  .poster { border: 0; max-width: none; padding-top: 40px; }
  .poster h1 { font-size: 3.4rem; }
  .poster-qr svg { width: 380px; }
}

/* ---- окно выбора города ---- */
dialog.sheet { border: 0; padding: 20px; border-radius: 20px; width: min(520px, 100vw - 24px); max-height: 85vh; overflow: auto; }
dialog.sheet::backdrop { background: rgba(20, 32, 27, .45); }
@media (max-width: 560px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet .chips { margin: 14px 0; }
.city-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.city-item { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px; font: inherit; cursor: pointer; }
.city-item.on { border-color: var(--found); background: #e6f3e8; font-weight: 600; }

/* ---- подвал и уведомления ---- */
.footer { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 20px 16px 90px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; max-width: 1080px; margin: 0 auto; width: 100%; }
.logo-small { font-weight: 800; color: var(--ink); }
@media (min-width: 561px) { .footer { padding-bottom: 24px; } }
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 12px; max-width: calc(100vw - 32px);
  transition: .2s; z-index: 50; font-size: .92rem;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
