:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #1b1f24;
  --muted: #667085;
  --brand: #4c8eff;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --danger: #c4320a;
  --danger-soft: #fdeee8;
  --warn: #8a5a00;
  --warn-soft: #fff5db;
  --ok: #157f3c;
  --ok-soft: #e6f6ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1e222a;
  --border: #2a2f38;
  --text: #e7e9ee;
  --muted: #98a2b3;
  --brand: #4c8eff;
  --accent: #4c8dff;
  --accent-ink: #0b1220;
  --accent-soft: #1b2a45;
  --danger: #ff8a65;
  --danger-soft: #3a1f17;
  --warn: #f5c451;
  --warn-soft: #33290f;
  --ok: #5fd08a;
  --ok-soft: #13301f;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code { font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem;
  padding: 0 24px; height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  color: var(--text); font-weight: 750; letter-spacing: -.03em; line-height: 1;
}
.brand:hover { text-decoration: none; }
.topbar .brand { font-size: 1.4rem; flex-shrink: 0; white-space: nowrap; }
.topbar .brand .one { color: var(--brand); }
.brand.big { font-size: 1.3rem; justify-content: center; flex-direction: column; text-align: center; }
.brand-mark {
  display: block; width: 36px; height: 36px; flex-shrink: 0; object-fit: contain;
}
.brand.big .brand-mark { width: 40px; height: 40px; }
.top-menu { display: flex; align-items: center; gap: 1.5rem; flex: 1; min-width: 0; }
.topbar nav { display: flex; gap: .25rem; }
.topbar nav a {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--muted); padding: .4rem .7rem; border-radius: 8px; font-weight: 500;
}
.topbar nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.topbar nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.topbar nav a:hover svg, .topbar nav a.active svg { opacity: 1; }
.topbar nav a.active { color: var(--text); background: var(--surface-2); }
.user { margin-left: auto; display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }
.user form { margin: 0; }
.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex; align-items: center; gap: .35rem; max-width: 220px;
  padding: .35rem .55rem; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer;
}
.user-menu-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.user-menu-btn:hover, .user-menu.is-open .user-menu-btn {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px;
  padding: .35rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
}
.user-menu-item {
  display: block; width: 100%; text-align: left; padding: .55rem .7rem; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer;
}
.user-menu-item:hover { background: var(--surface-2); text-decoration: none; }
.theme-toggle, .menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover, .menu-toggle:hover { background: var(--surface-2); }
.theme-toggle svg, .menu-toggle svg { width: 18px; height: 18px; display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
.menu-toggle { display: none; margin-left: auto; }
.menu-toggle .icon-close, .topbar.is-open .menu-toggle .icon-menu { display: none; }
.topbar.is-open .menu-toggle .icon-close { display: block; }

.app-modal {
  border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px);
}
.app-modal::backdrop { background: rgba(16, 24, 40, .45); }
.app-modal-card {
  width: min(400px, 100%); margin: auto; padding: 20px 20px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.app-modal-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 14px; }
.app-modal-head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.app-modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.app-modal-close:hover { background: var(--surface-2); color: var(--text); }
.app-modal-close svg { width: 16px; height: 16px; }
.app-modal-card label { margin-bottom: 12px; }
.app-modal-card label input { margin-top: .3rem; font-weight: 400; }
.app-modal-card .field-error { display: block; min-height: 1.1em; margin-top: .3rem; color: var(--danger); font-size: .85rem; font-weight: 400; }
.app-modal-card .msg { margin-bottom: 12px; }
.app-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 8px; }

/* ---------- layout */
.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page.wide { max-width: 1480px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.empty { text-align: center; padding: 64px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- forms */
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: 8px; padding: .5rem .65rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
select:disabled { opacity: .6; }
label { display: block; font-size: .85rem; font-weight: 550; margin-bottom: .3rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: .85rem; font-weight: 550; margin-bottom: .3rem; padding: 0; display: flex; gap: .5rem; width: 100%; }
legend .clear { margin-left: auto; font-weight: 400; }
.field { margin-bottom: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 550;
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[hidden] { display: none; }
.photo-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.photo-actions > * { flex: 1; }
.photo-note { margin: .4rem 0 0; }
.photo-note:empty { display: none; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

.messages { margin-bottom: 16px; display: grid; gap: 8px; }
.msg { padding: .6rem .9rem; border-radius: 8px; background: var(--accent-soft); }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-success { background: var(--ok-soft); color: var(--ok); }
.warn { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: .5rem .7rem; margin: .5rem 0; }
.warn a { color: inherit; text-decoration: underline; }
ul.plain { margin: .4rem 0 0; padding-left: 1.1rem; }

/* ---------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow); text-align: center;
}
.login-card label { text-align: left; margin-bottom: 14px; }
.login-card label input { margin-top: .3rem; font-weight: 400; }
.login-card .brand { justify-content: center; }
.login-card p { margin: .25rem 0 1.25rem; }
.login-card .small { margin: 1rem 0 0; }
.login-card .field-error { display: block; margin-top: .35rem; color: var(--danger); font-size: .85rem; font-weight: 400; }

/* ---------- ads list */
.list-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters {
  width: 100%; box-sizing: border-box;
  position: sticky; top: 80px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 8px 12px 16px;
}
.filters details { min-width: 0; }
.filters summary {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 28px; padding-right: 4px; font-weight: 650; cursor: pointer; margin: 0; list-style: none; user-select: none;
}
.filters summary::-webkit-details-marker { display: none; }
.filters details[open] > summary { margin-bottom: 12px; }
.filters-body {
  /* sticky top 80 + summary/padding ~66 + .page bottom pad 24 */
  max-height: calc(100vh - 170px); overflow-x: hidden; overflow-y: auto; min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent;
}
.filters-body #filters { padding-right: 8px; }
.filters-body::-webkit-scrollbar { width: 8px; }
.filters-body::-webkit-scrollbar-track { background: transparent; }
.filters-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
.filters-body::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 80%, transparent);
  background-clip: padding-box; border: 2px solid transparent;
}
.filters-chevron {
  width: 18px; height: 18px; flex-shrink: 0; color: var(--muted);
  transition: transform .15s ease;
}
.filters details[open] > summary .filters-chevron { transform: rotate(180deg); }
.check-list { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.check-list.short { max-height: 200px; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin: 0; padding: .25rem .4rem; border-radius: 6px; cursor: pointer; }
.check-list .check[hidden] { display: none !important; }
.check:hover { background: var(--surface-2); }
.check input { width: auto; margin: 0; }
.check span:first-of-type { flex: 1; }
.count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.mini-search { margin-bottom: 6px; padding: .35rem .55rem; font-size: .9rem; }
.range { display: flex; align-items: center; gap: .4rem; }
.filter-actions { display: flex; gap: .5rem; }
.filter-actions .btn { flex: 1; }

.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 12px; flex-wrap: wrap; }
.results-head p { margin: 0; }
.results-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.results-actions .inline-form { display: flex; }
.results-actions .btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.results-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  margin-bottom: 16px; flex-wrap: wrap;
}
.results-view { display: flex; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.results-prefs { display: flex; gap: .5rem; align-items: center; margin-left: auto; min-width: 0; }
.results-prefs select { width: auto; max-width: 280px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .12); }
.card-hit { position: absolute; inset: 0; z-index: 1; }
.card-hit:hover { text-decoration: none; }
.card.removed .thumb img { filter: grayscale(1); opacity: .6; }
.card-wrap { position: relative; display: flex; flex-direction: column; }
.card-wrap > .card { flex: 1; }
.fav-toggle {
  position: absolute; z-index: 2; left: 8px; top: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.fav-toggle.on { color: #ffc83d; background: rgba(0, 0, 0, .6); }
.fav-toggle:hover { background: rgba(0, 0, 0, .7); }
.inline-form { margin: 0; display: inline; }
.card-wrap .badge-removed { left: 50px; top: 14px; }
.fav-big.on { color: #b7791f; border-color: #e9c46a; background: #fff8e1; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; flex: none; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; user-select: none; }
.thumb.is-swipeable { z-index: 2; touch-action: pan-y; }
.thumb.is-swipeable .badge { pointer-events: none; }
.gallery-main.is-swipeable { touch-action: pan-y; }
.gallery-main.is-swipeable .badge,
.gallery-main.is-swipeable .nav { touch-action: manipulation; }
.no-photo, .gallery-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .9rem; }
.gallery-empty { height: 200px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.badge { position: absolute; font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: 6px; }
.badge-photos { right: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); color: #fff; }
.badge-removed { left: 8px; top: 8px; background: var(--danger); color: #fff; }
.card-body { padding: 12px 14px 8px; display: flex; flex-direction: column; flex: 1; }
.card-main { display: flex; align-items: flex-end; gap: .5rem; }
.card-meta { display: grid; gap: 6px; flex: 1; min-width: 0; align-content: start; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.price { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.price.big { font-size: 1.75rem; }
.facts { display: flex; flex-wrap: wrap; gap: .2rem .6rem; font-size: .9rem; }
.facts span { color: var(--muted); }
.loc { font-size: .9rem; color: var(--muted); }
.loc strong { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .55rem; }
.chip.more { color: var(--muted); }
.card .warn { margin: 0; padding: .3rem .5rem; }
.card-foot { display: flex; justify-content: space-between; gap: .5rem; padding: 8px 14px 12px; border-top: 1px solid var(--border); margin-top: 6px; }
.card-wrap.compact .card-body { padding-bottom: 10px; }
.card-warn {
  position: relative; z-index: 2; flex: none; align-self: flex-end;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: var(--warn-soft); color: var(--warn); cursor: pointer;
}
.card-warn svg { width: 16px; height: 16px; display: block; }
.card-warn .tip {
  display: none; position: absolute; z-index: 3; right: 0; bottom: calc(100% + 6px);
  width: max-content; max-width: 230px; padding: .45rem .6rem;
  border-radius: 8px; background: var(--warn-soft); color: var(--warn);
  border: 1px solid var(--warn); box-shadow: 0 6px 18px rgba(16, 24, 40, .18);
  font-size: .8rem; font-weight: 500; line-height: 1.35; text-align: left;
  pointer-events: none; white-space: normal;
}
.card-warn:hover .tip, .card-warn:focus-visible .tip, .card-warn.is-open .tip { display: block; }
.card-flags { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 6px; flex: none; align-self: flex-end; }
.card-note {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); cursor: pointer;
}
.card-note svg { width: 16px; height: 16px; display: block; }
.card-note .tip {
  display: none; position: absolute; z-index: 3; right: 0; bottom: calc(100% + 6px);
  width: 260px; max-width: min(260px, 70vw); max-height: 240px; overflow: auto;
  padding: .55rem .7rem; border-radius: 8px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(16, 24, 40, .18);
  font-size: .8rem; font-weight: 450; line-height: 1.4; text-align: left; white-space: normal;
}
.card-note.is-open .tip { display: block; }
.card-note .note-pop + .note-pop { margin-top: .65rem; padding-top: .55rem; border-top: 1px solid var(--border); }
.card-note .note-pop strong { display: block; margin-bottom: .2rem; font-size: .75rem; color: var(--muted); font-weight: 600; }
.share-notes { margin: 0 0 .75rem; padding: .35rem 0; }
.share-notes input { width: auto; }
.share-mode {
  display: grid; gap: .25rem; margin: 0 0 14px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-mode .check { margin: 0; padding: .25rem 0; }
#notes textarea { min-height: 8rem; resize: vertical; margin-bottom: .6rem; }
#notes .btn { margin-top: .25rem; }
.colleague-note { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--border); }
.colleague-note .small { margin: 0 0 .35rem; }
.note-text { white-space: pre-wrap; font-size: .95rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 24px 0 8px; }

/* ---------- ad detail */
.back { display: inline-block; margin-bottom: 12px; }
.banner { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 16px; }
.banner-removed { background: var(--danger-soft); color: var(--danger); border: 1px solid currentColor; }
.ad-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 16px; flex-wrap: wrap; }
.loc-line { margin: 0; color: var(--muted); font-size: 1.05rem; }
.ad-price { text-align: right; }
.ad-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ad-main > * + * { margin-top: 16px; }
.ad-side { position: sticky; top: 80px; }

.gallery-main { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; -webkit-user-drag: none; user-select: none; }
.gallery-main .nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .85); color: #111; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.gallery-main .prev { left: 10px; }
.gallery-main .next { right: 10px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; }
.thumbs button { flex: 0 0 88px; height: 66px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: none; }
.thumbs button.active { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; margin: 0; }
.specs dt, .timeline dt { font-size: .8rem; color: var(--muted); }
.specs dd { margin: 0; font-weight: 550; }
.description { white-space: normal; line-height: 1.6; }
.phone { display: block; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ad-side .btn.full { margin-top: .75rem; }
.timeline { margin: 0; display: grid; gap: 8px; }
.timeline div { display: flex; justify-content: space-between; gap: 1rem; }
.timeline dd { margin: 0; text-align: right; font-size: .9rem; }
.timeline .removed-row dt, .timeline .removed-row dd { color: var(--danger); font-weight: 600; }
.chart { width: 100%; height: 80px; margin-bottom: 8px; }
.chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart circle { fill: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th.num { text-align: right; }
.history td.up { color: var(--danger); }
.history td.down { color: var(--ok); }

/* ---------- searches */
.search-cards { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin: 20px 0 32px; align-items: start; }
.search-cards .panel + .panel { margin-top: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.jobs td.actions form { margin: 0; }
.status { font-size: .78rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.status-running { background: var(--accent-soft); color: var(--accent); }
.status-queued { background: var(--warn-soft); color: var(--warn); }
.status-done { background: var(--ok-soft); color: var(--ok); }
.status-failed { background: var(--danger-soft); color: var(--danger); }

/* ---------- small screens */
@media (max-width: 1000px) {
  .ad-layout { grid-template-columns: minmax(0, 1fr); }
  .ad-side { position: static; }
}
@media (max-width: 860px) {
  .results-head { flex-direction: column; align-items: stretch; gap: .75rem; }
  .results-actions { width: 100%; }
  .results-actions .inline-form, .results-actions .btn { flex: 1; }
  .results-actions .btn { width: 100%; }
  .results-toolbar { flex-direction: column; align-items: stretch; gap: .5rem; }
  .results-view { width: 100%; }
  .results-view .seg { flex: 1; }
  .results-view .seg a { flex: 1; padding: .4rem .3rem; font-size: .85rem; }
  .results-prefs { width: 100%; margin-left: 0; }
  .results-prefs select { flex: 1; min-width: 0; max-width: none; }
  .list-layout, .search-cards { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; }
  .filters-body { max-height: none; }
  .deal-bar { flex-wrap: wrap; align-items: stretch; gap: .5rem .75rem; }
  .deal-tabs { width: 100%; }
  .deal-search {
    flex: 1 1 100%; width: 100%; min-width: 0; max-width: none; padding-bottom: .5rem;
  }
  .deal-search-field { flex: 1 1 auto; width: 100%; min-width: 0; }
  .topbar { padding: 0 16px; gap: .75rem; }
  .menu-toggle { display: inline-flex; }
  .top-menu {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: .5rem 12px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .topbar.is-open .top-menu { display: flex; }
  .topbar nav { flex-direction: column; gap: .25rem; }
  .topbar nav a { padding: .7rem .75rem; }
  .user {
    margin: .5rem 0 0; padding: .75rem; gap: .6rem; flex-wrap: wrap;
    border-top: 1px solid var(--border);
  }
  .user-menu { width: 100%; }
  .user-menu-btn { width: 100%; max-width: none; justify-content: space-between; }
  .user-menu-panel { position: static; margin-top: .4rem; box-shadow: none; }
}
@media (max-width: 600px) {
  .page { padding: 16px; }
  .ad-price { text-align: left; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .results-view { flex-direction: column; }
  .results-view .seg { width: 100%; }
  .results-view .seg a { font-size: .9rem; padding: .45rem .6rem; }
}

/* ---------- maps */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg a { padding: .4rem .75rem; color: var(--muted); font-weight: 550; text-align: center; white-space: nowrap; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.seg a.active { background: var(--accent-soft); color: var(--accent); }
.big-map { height: calc(100vh - 220px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 0; }
.map-legend { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: 8px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); margin-left: .6rem; }
.dot:first-child { margin-left: 0; }
.dot.exact { background: var(--accent); }
.dot.approx { border-style: dashed; background: var(--accent-soft); }
.map-pop { display: block; color: #1b1f24; min-width: 180px; line-height: 1.4; }
.map-pop:hover { text-decoration: none; }
.map-pop img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; }
.pill { font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.monitor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.monitor-grid .panel + .panel { margin-top: 0; }
.lane { border-left: 3px solid var(--border); padding: .35rem 0 .35rem .7rem; margin-top: .6rem; }
.lane-ok { border-color: var(--ok); }
.lane-warn { border-color: var(--warn); }
.lane-bad { border-color: var(--danger); }
.warn-text { color: var(--danger); }
.alert-edit input { min-width: 260px; }

/* ---------- alerts */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.alerts-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.25rem 2rem; margin-bottom: .75rem; flex-wrap: wrap;
}
.alerts-hero-copy { min-width: 0; flex: 1 1 280px; }
.alerts-hero-copy h1 { margin-bottom: .35rem; }
.alerts-hero-copy p { margin: 0; max-width: 42rem; }
.alerts-email { word-break: break-word; }
.alerts-usage {
  flex: 0 0 auto; min-width: 160px; padding: .75rem .9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.alerts-usage-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  margin-bottom: .45rem;
}
.alerts-usage-count { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.alerts-usage-bar {
  height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.alerts-usage-bar > span {
  display: block; height: 100%; border-radius: inherit; background: var(--accent); max-width: 100%;
}
.alerts-hint { margin: 0 0 1.25rem; }
.alert-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px;
}
.alert-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  display: grid; gap: 14px;
}
.alert-card.is-paused { opacity: .82; }
.alert-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
}
.alert-name-form { flex: 1; min-width: 0; margin: 0; }
.alert-name-form input {
  width: 100%; font-weight: 650; font-size: 1.02rem; letter-spacing: -.01em;
  border-color: transparent; background: transparent; padding: .2rem .35rem; margin: -.2rem -.35rem;
}
.alert-name-form input:hover { border-color: var(--border); background: var(--surface); }
.alert-name-form input:focus { background: var(--surface); }
.alert-meta {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px;
}
.alert-meta-item { min-width: 0; display: grid; gap: .25rem; align-content: start; }
.alert-meta-label {
  font-size: .75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
}
.alert-meta-value { font-size: .95rem; word-break: break-word; text-align: left; }
.alert-meta-value.num { text-align: left; }
.alert-freq-form { margin: 0; }
.alert-freq-form select { width: 100%; max-width: 100%; }
.alert-card-actions {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.alert-card-actions form { margin: 0; display: flex; }
.alert-card-actions .btn { flex: 0 1 auto; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.alerts-empty { display: grid; justify-items: center; gap: .75rem; }
.alerts-empty h2 { margin: 0; }
.alerts-empty p { margin: 0; max-width: 28rem; }
.alerts-empty .btn { margin-top: .35rem; }
@media (max-width: 860px) {
  .alert-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .alerts-hero { align-items: stretch; gap: .85rem; }
  .alerts-usage { width: 100%; }
  .alert-card { padding: 14px; gap: 12px; }
  .alert-card-top { align-items: center; gap: .5rem; }
  .alert-name-form input { font-size: 1rem; }
  .alert-meta { gap: 12px; }
  .alert-meta-item:nth-child(2) { grid-column: 1 / -1; }
  .alert-card-actions > a.btn { flex: 1 1 100%; }
  .alert-card-actions form { flex: 1 1 calc(50% - .25rem); }
  .alert-card-actions .btn {
    width: 100%; justify-content: center;
    min-height: 42px; padding: .55rem .7rem;
  }
}
.map-embed { width: 100%; height: 340px; border: 1px solid var(--border); border-radius: 8px; display: block; }
.map-links { display: flex; gap: 1rem; flex-wrap: wrap; margin: .6rem 0 0; }
.map-links .muted { margin-left: auto; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .big-map { height: 70vh; }
}

/* ---------- deals and video */
.deal-bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.deal-tabs { display: flex; gap: 4px; min-width: 0; margin: 0; border-bottom: 0; }
.deal-tabs a { padding: .5rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.deal-tabs a:hover { color: var(--text); text-decoration: none; }
.deal-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.deal-tabs .count { font-weight: 500; margin-left: .25rem; }
.deal-search {
  display: flex; align-items: center; gap: .45rem;
  flex: 1 1 460px; min-width: 260px; max-width: 450px; padding-bottom: .35rem;
}
.deal-search-label {
  flex: none; margin: 0; font-size: .9rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.deal-search-field {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center;
  height: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.deal-search-field:focus-within {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
.deal-search-field input {
  flex: 1 1 auto; min-width: 0; height: 100%;
  padding: .25rem .2rem .25rem .55rem; border: 0; border-radius: 8px 0 0 8px;
  background: transparent; font-size: .9rem; line-height: 1.2;
}
.deal-search-field input:focus { outline: none; border-color: transparent; }
.deal-search-field input::-webkit-search-decoration,
.deal-search-field input::-webkit-search-cancel-button { appearance: none; }
.deal-search-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 100%; padding: 0; margin: 0; border: 0; border-radius: 0 8px 8px 0;
  background: transparent; color: var(--muted); cursor: pointer;
}
.deal-search-btn:hover { color: var(--text); background: transparent; text-decoration: none; }
.deal-search-btn svg { width: 16px; height: 16px; display: block; }
.deal-bar + .deal-tabs { margin-top: -6px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.price small { font-size: .7em; font-weight: 600; color: var(--muted); }
.pill-sale { background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.pill-rent { background: var(--warn-soft); color: var(--warn); vertical-align: middle; }
h1 .pill { font-size: .8rem; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- sources */
.steps { padding-left: 1.2rem; margin: .5rem 0 .9rem; }
.steps li + li { margin-top: .3rem; }
.search-cards > div > .panel + .panel { margin-top: 16px; }
.badge-source { left: 8px; bottom: 8px; background: #3a77ff; color: #fff; }
.badge-source.olx { background: #23e5db; color: #002f34; }
input[type=file] { padding: .4rem; margin-bottom: .75rem; }
.badge-source.alo { background: #ff7a00; color: #fff; }
.status-waiting { background: var(--warn-soft); color: var(--warn); }

/* ---------- processing status */
.badge-proc-thumb { right: 8px; top: 8px; }
.badge-new { background: var(--accent); color: #fff; }
.badge-added { background: var(--ok); color: #fff; }
.badge-notadded { background: var(--warn); color: #fff; }
.status-buttons { display: flex; flex-direction: column; gap: .4rem; }
.btn-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.btn-warn:hover { background: var(--warn); color: #fff; }

/* ---------- market research */
.market-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.market-head h1 { margin-bottom: .2rem; }
.market-toolbar {
  display: flex; align-items: flex-end; flex-wrap: nowrap; gap: 8px 16px;
  margin: 16px 0 20px; border-bottom: 1px solid var(--border);
}
.market-tabs { display: flex; align-items: flex-end; flex: 0 0 auto; gap: 4px; margin-left: auto; }
.market-tabs a, .market-tabs span {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; margin-bottom: -1px;
  padding: 0 .85rem; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.market-tabs a:hover { color: var(--text); text-decoration: none; }
.market-tabs a.active, .market-tabs span.active { color: var(--text); border-bottom-color: var(--accent); background: transparent; }
.market-tab-icon { width: 16px; height: 16px; display: block; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.market-filters { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0; min-width: 0; padding-bottom: 12px; }
.market-filters label { margin: 0; min-width: 0; font-size: .78rem; color: var(--muted); }
.market-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 1px; }
.market-switch a { padding: .45rem .7rem; color: var(--text); background: var(--surface); }
.market-switch a.active { background: var(--accent); color: var(--accent-ink); }
.market-switch a:hover { text-decoration: none; }
.market-filters .market-switch,
.market-filters select,
.market-place-btn,
.market-type-btn { height: 40px; }
.market-filters .market-switch { align-items: stretch; margin-bottom: 0; }
.market-filters .market-switch a {
  display: flex; align-items: center; justify-content: center;
  flex: 1 0 auto; padding: 0 1rem; white-space: nowrap;
}
.market-filters select {
  display: block; width: 136px; max-width: 100%; line-height: 38px;
  appearance: none; -webkit-appearance: none;
  padding: 0 1.75rem 0 .65rem;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 1px), calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.market-field { min-width: 0; font-size: .78rem; font-weight: 550; color: var(--muted); }
.market-deal-field { flex: 0 0 auto; }
.market-place-field { position: relative; min-width: 120px; flex: 1 1 120px; max-width: 200px; }
.market-place { position: relative; }
.market-place-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 .65rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.market-place-btn:hover { border-color: var(--muted); }
.market-place-btn[aria-expanded="true"] { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.market-place-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-place-btn::after {
  content: ""; flex: none; border: 5px solid transparent; border-top-color: var(--muted); border-bottom: 0;
}
.market-filters select, .market-place-btn, .market-filters .market-switch { font-size: 15px; }
.market-type-field, .market-rooms-field { position: relative; flex: 0 0 auto; }
.market-type-btn { width: auto; }
.market-type { position: relative; }
.market-type-btn .market-type-current { display: flex; align-items: center; gap: 8px; min-width: 0; }
#market-rooms .market-type-menu,
#market-hood .market-type-menu { min-width: 100%; width: max-content; }
.market-hood-field { flex: 0 0 auto; }
#market-hood .market-type-btn { min-width: 180px; }
#market-hood .market-place-value { overflow: visible; text-overflow: clip; }
#market-hood .market-type-option { white-space: nowrap; }
#market-hood .market-type-menu { max-height: min(70vh, 420px); overflow: auto; }
.market-type-menu {
  position: absolute; z-index: 1000; top: calc(100% + 6px); left: 0; min-width: 240px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
.market-type-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); font-size: 15px; font-weight: 500;
}
.market-type-option:hover { background: var(--surface-2); text-decoration: none; }
.market-type-option.is-current { background: var(--accent-soft); }
.market-type-icon { flex: none; display: flex; color: var(--text); }
.market-type-icon svg, .market-type-check svg {
  width: 20px; height: 20px; display: block; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.market-type-check { margin-left: auto; color: var(--accent); display: flex; }
.market-place-panel {
  position: absolute; z-index: 1000; top: calc(100% + 6px); left: 0;
  width: min(520px, calc(100vw - 32px)); max-height: min(70vh, 640px); overflow: auto;
  padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
.market-place-search {
  position: sticky; top: 0; z-index: 1; margin-bottom: 8px; font-size: 16px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>");
  background-repeat: no-repeat; background-position: 10px 50%; background-size: 16px; padding-left: 34px;
}
.market-place-country, .market-place-grid a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 8px; border-radius: 8px; color: var(--text);
}
.market-place-country { font-weight: 650; margin-bottom: 4px; }
.market-place-country:hover, .market-place-grid a:hover { background: var(--surface-2); text-decoration: none; }
.market-place-country.is-current, .market-place-grid a.is-current { background: var(--accent-soft); color: var(--accent); }
.market-place-heading { margin: 12px 8px 4px; font-size: .95rem; font-weight: 700; color: var(--text); }
.market-place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.market-place-grid.is-major { grid-auto-flow: column; grid-template-rows: repeat(var(--rows), auto); }
.market-place-name { min-width: 0; }
.market-place-hint { display: block; color: var(--muted); font-size: .75rem; font-weight: 450; }
.market-place-price, .market-place-count { color: var(--muted); font-weight: 450; font-variant-numeric: tabular-nums; white-space: nowrap; }
.market-place-grid a.is-current .market-place-price { color: inherit; }
.market-oblast-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.market-oblast-toggle:hover { background: var(--surface-2); }
.market-oblast-meta { display: inline-flex; align-items: center; gap: 8px; font-weight: 450; }
.market-oblast-toggle .chevron {
  width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin-top: -4px;
}
.market-oblast-toggle[aria-expanded="true"] .chevron { transform: rotate(-135deg); margin-top: 2px; }
.market-place-empty, .market-place-note { margin: 8px; font-size: .9rem; }
.market-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi p { margin: 0; }
.kpi .value { font-size: 1.7rem; font-weight: 650; margin: .15rem 0; letter-spacing: -.02em; }
.kpi .value span { font-size: .95rem; font-weight: 550; color: var(--muted); }
.kpi-ads { container-type: inline-size; }
.kpi-ads-title .long { display: none; }
@container (min-width: 300px) {
  .kpi-ads-title .short { display: none; }
  .kpi-ads-title .long { display: inline; }
}
.kpi-ads-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; margin: 0; }
.kpi-ads-foot a { margin-left: auto; color: var(--accent); font-weight: 650; white-space: nowrap; }
.kpi-ads-foot a:hover { text-decoration: none; }
.market-all-ads { margin: 0 0 16px; }
.market-all-ads a {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--accent); font-weight: 650; line-height: 1.35;
}
.market-all-ads a:hover { text-decoration: none; border-color: var(--accent); }
.market-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: 16px; align-items: start; }
.market-layout > * { min-width: 0; }
.market-map { height: 520px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 0; overflow: hidden; max-width: 100%; }
.market-legend { color: var(--muted); font-size: .85rem; }
.market-legend .scale {
  display: inline-block; width: 88px; height: 8px; border-radius: 99px; vertical-align: middle; margin-right: 6px;
  background: linear-gradient(90deg, hsl(48, 85%, 56%), hsl(0, 85%, 42%));
}
.market-table-wrap { max-height: 520px; max-width: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.market-table-wrap table { margin: 0; width: 100%; }
.market-table-wrap .market-sort {
  display: inline-flex; align-items: center; gap: 4px; width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  letter-spacing: inherit; text-transform: inherit; cursor: pointer;
}
.market-table-wrap th.num .market-sort { justify-content: flex-end; }
.market-table-wrap .market-sort .arrow { font-size: .75rem; opacity: .45; }
.market-table-wrap .market-sort[aria-sort="ascending"] .arrow,
.market-table-wrap .market-sort[aria-sort="descending"] .arrow { opacity: 1; color: var(--accent); }
.market-chart-block { margin: 22px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; max-width: 100%; }
.market-chart-canvas { position: relative; height: 320px; max-width: 100%; }
.market-chart-canvas canvas { display: block; max-width: 100%; }
.market-chart-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.market-chart-bar h2 { margin: 0 0 8px; }
.market-compare { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 10px; }
.market-compare .check { font-weight: 450; font-size: .9rem; margin: 0; display: flex; gap: .35rem; align-items: center; }
.market-compare input { width: auto; }
.market-others-block { margin: 22px 0; }
.market-others-block h2 { margin-bottom: 12px; }
.market-others { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.market-other {
  display: flex; align-items: flex-start; gap: 12px; min-width: 0;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: inherit;
}
.market-other:hover { text-decoration: none; border-color: var(--accent); }
.market-other .market-type-icon { color: var(--accent); margin-top: 2px; }
.market-other-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.market-other-name { font-weight: 650; }
.market-other .muted { font-size: .85rem; }
.market-method { margin-top: 28px; color: var(--muted); font-size: .92rem; }
.market-method h2 { color: var(--text); }
.up { color: var(--ok); }
.down { color: var(--danger); }
.provisional { color: var(--warn); font-weight: 700; }
@media (max-width: 900px) {
  .market-layout { grid-template-columns: minmax(0, 1fr); }
  .market-map { height: 320px; }
  .market-chart-canvas { height: 260px; }
}
@media (max-width: 720px) {
  .market-head { align-items: stretch; }
  .market-head h1 { font-size: 1.45rem; }
  .market-head .muted { font-size: .9rem; }
  .market-toolbar { flex-direction: column; align-items: stretch; gap: 0; border-bottom: 0; }
  .market-tabs { order: -1; width: 100%; margin-left: 0; border-bottom: 1px solid var(--border); }
  .market-tabs a, .market-tabs span { flex: 1; justify-content: center; padding: 0 .65rem; }
  .market-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: 100%; padding-top: 12px; }
  .market-filters > * { order: 3; }
  .market-deal-field { order: 1; }
  .market-place-field { order: 2; }
  .market-filters label, .market-field { min-width: 0; }
  .market-filters select, .market-place-btn, .market-place-search,
  .market-filters .market-switch, .market-type-option { font-size: 16px; }
  .market-filters select, .market-type-btn, .market-place-btn { width: 100%; }
  .market-type-field, .market-rooms-field, .market-hood-field { min-width: 0; width: 100%; }
  #market-hood .market-type-btn { width: 100%; min-width: 0; }
  .market-type-menu { width: 100%; min-width: 0; }
  .market-place-field { max-width: none; }
  .market-place-panel { width: 100%; }
  .market-place-grid, .market-place-grid.is-major { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
  .market-switch { width: 100%; }
  .market-filters .market-switch a { flex: 1 1 0; padding: 0 1rem; }
  .market-kpis { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi .muted { font-size: .8rem; line-height: 1.3; }
  .kpi .value { font-size: 1.45rem; }
  .kpi .value span { display: inline; font-size: .85rem; }
  .market-table-wrap { max-height: none; }
  .market-table-wrap table { table-layout: fixed; }
  .market-table-wrap th, .market-table-wrap td { padding: .45rem .3rem; overflow-wrap: anywhere; }
  .market-table-wrap th:nth-child(n+2),
  .market-table-wrap td:nth-child(n+2) { width: 4.4rem; }
  .market-chart-block { padding: 12px; }
  .market-chart-bar { align-items: stretch; }
  .market-chart-bar h2 { font-size: 1.05rem; }
  .market-chart-bar .market-switch { width: 100%; }
  .market-chart-canvas { height: 300px; }
  .market-compare .btn { width: 100%; min-height: 42px; }
  .market-legend { font-size: .8rem; }
}

