:root {
  --paper: var(--tg-theme-bg-color, #f5f7f5);
  --card: var(--tg-theme-secondary-bg-color, #fff);
  --ink: var(--tg-theme-text-color, #202721);
  --muted: var(--tg-theme-hint-color, #78827b);
  --line: color-mix(in srgb, var(--ink) 10%, transparent);
  --green: #277658;
  --green-wash: #e8f3ec;
  --lime: #d9efac;
  --red: #a33530;
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 720px; min-height: 100svh; margin: 0 auto; padding: max(env(safe-area-inset-top), 18px) 19px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 5px 1px 22px; }
.identity { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 15px; background: var(--lime); color: #274524; font-size: 28px; font-weight: 760; line-height: 1; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 9px; font-weight: 720; letter-spacing: .105em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: -.04em; line-height: 1.05; }
.icon-button { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; font-size: 25px; line-height: 1; }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.icon-button:disabled { opacity: .5; cursor: default; }
.summary-card { padding: 15px 17px; border: 1px solid color-mix(in srgb, var(--green) 12%, transparent); border-radius: 15px; background: color-mix(in srgb, var(--green-wash) 74%, var(--card)); }
.summary-main { display: flex; align-items: center; gap: 9px; }
.summary-main p { margin: 0; font-size: 13px; font-weight: 670; }
.pulse-dot { width: 8px; height: 8px; flex: none; border-radius: 100%; background: #398b58; box-shadow: 0 0 0 4px #398b581c; }
.summary-meta { margin: 6px 0 0 17px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.tabs { display: flex; gap: 7px; overflow-x: auto; margin: 19px -2px 13px; padding: 0 2px 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; min-height: 37px; align-items: center; gap: 7px; flex: none; padding: 0 14px; border: 1px solid transparent; border-radius: 99px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 620; }
.tab span:not(:empty) { display: grid; min-width: 20px; height: 20px; place-items: center; padding: 0 5px; border-radius: 99px; background: #0000000b; font-size: 10px; }
.tab.is-active { background: var(--card); color: var(--ink); border-color: var(--line); box-shadow: 0 2px 9px #17271a08; }
.content { display: grid; gap: 12px; }
.ad-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.ad-content { display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 13px; padding: 12px; }
.ad-photo { width: 98px; height: 101px; border-radius: 12px; background: linear-gradient(140deg, #edf1e8, #f3f2e7); object-fit: cover; }
.ad-details { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.ad-title { display: -webkit-box; overflow: hidden; margin: 0 0 7px; color: var(--ink); font-size: 14px; font-weight: 635; line-height: 1.35; text-decoration: none; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ad-price { margin: 0; font-size: 18px; font-weight: 740; letter-spacing: -.025em; }
.ad-location { overflow: hidden; max-width: 100%; margin: 4px 0 0; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ad-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 10px; }
.badge { max-width: 100%; overflow: hidden; padding: 5px 7px; border-radius: 7px; background: #f2f4ef; color: #57645a; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.badge.deal { background: #e5f3e7; color: #256144; font-weight: 700; }
.badge.needs-data { background: #f3f2ed; color: #76766c; }
.ad-actions { display: flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 12px 11px; }
.text-button { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 590; text-decoration: none; }
.text-button.favorite-on { color: #7a5313; background: #fff8e5; }
.text-button.open-ad { margin-left: auto; color: var(--green); border-color: #2776582c; }
.notice { padding: 12px 14px; border: 1px solid #c8daba; border-radius: 13px; background: #f0f6e9; color: #394c35; font-size: 12px; line-height: 1.5; }
.notice.error { border-color: #efd0ca; background: #fff2f0; color: #8e3731; }
.empty-state { padding: 31px 20px 35px; border: 1px dashed color-mix(in srgb, var(--muted) 33%, transparent); border-radius: 18px; text-align: center; }
.empty-icon { display: grid; width: 52px; height: 52px; place-items: center; margin: 0 auto 13px; border-radius: 18px; background: var(--green-wash); color: var(--green); font-size: 24px; }
.empty-state h2 { margin-bottom: 7px; font-size: 17px; letter-spacing: -.02em; }
.empty-state p { max-width: 370px; margin: 0 auto 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.bottom-bar { position: fixed; z-index: 2; right: 0; bottom: 0; left: 0; padding: 11px 19px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in srgb, var(--ink) 5%, transparent); background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(18px); }
.bottom-bar .primary-button { width: 100%; }
.primary-button { display: inline-flex; min-height: 47px; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 0; border-radius: 14px; background: #27694e; color: #fff; cursor: pointer; font-size: 13px; font-weight: 700; transition: transform .16s ease, background-color .16s ease; }
.primary-button:active { transform: scale(.985); background: #20553f; }
.primary-button:disabled { opacity: .64; cursor: wait; }
.primary-button span { font-size: 19px; font-weight: 400; }
.search-dialog { width: min(100% - 20px, 520px); max-height: min(88dvh, 820px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: 0 26px 100px #18281e36; }
.search-dialog::backdrop { background: #18251e70; backdrop-filter: blur(3px); }
.search-form { display: grid; gap: 17px; padding: 22px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 4px; }
.dialog-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.field-label { display: grid; gap: 7px; min-width: 0; color: var(--ink); font-size: 12px; font-weight: 630; }
.field-label input, .field-label textarea, .field-label select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: var(--card); color: var(--ink); font-size: 13px; }
.field-label textarea { resize: vertical; }
.field-label input:focus, .field-label textarea:focus, .field-label select:focus { border-color: #398765; box-shadow: 0 0 0 3px #39876522; }
fieldset { display: grid; gap: 11px; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 9px; font-size: 12px; font-weight: 650; }
.city-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.check-row input { width: 17px; height: 17px; flex: none; margin: 0; accent-color: var(--green); }
.optional { color: var(--muted); font-size: 10px; font-weight: 450; }
.save-button { width: 100%; margin-top: 2px; }
.form-error { padding: 10px; border-radius: 9px; background: #fff2f0; color: var(--red); font-size: 12px; line-height: 1.45; }
.search-list { display: grid; gap: 8px; }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.search-row h3 { margin: 0 0 4px; overflow-wrap: anywhere; font-size: 13px; }
.search-row p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.search-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.search-actions .text-button { min-height: 31px; padding: 4px 7px; }
.search-row.is-paused { opacity: .65; }
.warning-copy { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.skeleton { min-height: 152px; border-radius: var(--radius); background: linear-gradient(90deg, #ecefea 25%, #f4f5f2 40%, #ecefea 55%); background-size: 280% 100%; animation: shimmer 1.6s ease infinite; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes shimmer { to { background-position: -120% 0; } }
@media (min-width: 600px) { .app-shell { padding-top: 28px; }.topbar { margin-bottom: 25px; }.ad-content { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 15px; }.ad-photo { width: 120px; height: 112px; }.bottom-bar { padding-right: max(calc((100vw - 680px)/2), 19px); padding-left: max(calc((100vw - 680px)/2), 19px); }.bottom-bar .primary-button { width: auto; min-width: 240px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
