:root {
  --bg: #060606;
  --panel: #0F0F0F;
  --panel-2: #141414;
  --line: #1E1E1E;
  --line-2: #2E2E2E;
  --text: #F5F5F5;
  --muted: #7A7A7A;
  --dim: #A3A3A3;
  --accent: #C6FF3D;
  --accent-ink: #0A0A0A;
  --red: #FF3D3D;
  --header-bg: rgba(6,6,6,.86);
  --btn-hover: #d6ff6b;
  --r: 6px;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
.container { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 32px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 64px; }
.logo { font-weight: 800; letter-spacing: -.02em; font-size: 17px; text-decoration: none; white-space: nowrap; }
.brand-red { color: var(--red); }
nav.main { display: flex; gap: 22px; font-size: 14px; }
nav.main a { color: var(--dim); text-decoration: none; transition: color .15s; }
nav.main a:hover, nav.main a[aria-current] { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; font: 500 13px var(--font); color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s, transform .15s; }
.btn:hover { border-color: #444; background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .5; cursor: default; }

/* page */
.page { flex: 1; padding-top: 40px; padding-bottom: 72px; }
.page-head h1 { font-size: clamp(30px, 4.5vw, 48px); line-height: 1.05; letter-spacing: -.03em; font-weight: 800; }
.lead { margin-top: 12px; max-width: 64ch; color: var(--dim); font-size: 15px; }

.market-tabs { display: flex; gap: 4px; margin: 28px 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.market-tabs button { padding: 12px 18px; font: 500 14px var(--font); color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; transition: color .15s; }
.market-tabs button:hover { color: var(--text); }
.market-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.market-tabs .count { margin-left: 6px; font: 400 12px var(--mono); color: var(--muted); }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 32px; align-items: start; }

/* filters */
.filters { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; min-width: 0; }
.field label, .field legend { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select { width: 100%; padding: 10px 32px 10px 12px; font: 400 14px var(--font); color: var(--text); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23A3A3A3' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center; border: 1px solid var(--line-2); border-radius: var(--r); appearance: none; -webkit-appearance: none; cursor: pointer; transition: border-color .15s; }
select:hover:not(:disabled) { border-color: #444; }
select:disabled { opacity: .45; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; font: 500 13px var(--font); color: var(--dim); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: #444; color: var(--text); }
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.chip .n { margin-left: 5px; font: 400 11px var(--mono); opacity: .6; }
.btn-reset { background: none; color: var(--dim); }
.filters-toggle { display: none; }
.badge { min-width: 20px; padding: 1px 6px; font: 600 11px var(--mono); color: var(--accent-ink); background: var(--accent); border-radius: 10px; }

/* results */
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.found { font: 500 13px var(--mono); color: var(--dim); }
.found strong { color: var(--text); font-weight: 600; }
.sort { display: flex; align-items: center; gap: 10px; }
.sort label { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sort select { width: auto; min-width: 170px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card .photo { position: relative; aspect-ratio: 4 / 3; background: var(--panel-2); overflow: hidden; }
.card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .photo .noimg { position: absolute; inset: 0; display: grid; place-items: center; font: 400 12px var(--mono); color: var(--muted); }
.card .body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; flex: 1; }
.card h3 { font-size: 16px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.card .specs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--dim); }
.card .badge-line { font: 400 11px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .price { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.card .price .src { font: 500 13px var(--mono); color: var(--dim); }
.card .price .rub { margin-top: 2px; font-size: 22px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.card .price .rub small { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.card .turnkey { font-size: 13px; color: var(--accent); min-height: 0; }
.card .turnkey:empty { display: none; }
.card .turnkey.err { color: var(--dim); }
.card .actions { display: flex; gap: 8px; }
.card .actions .btn { flex: 1; padding: 9px 10px; }
.card .lotid { font: 400 11px var(--mono); color: var(--muted); }

.empty { padding: 48px 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.more { display: flex; justify-content: center; margin-top: 28px; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; flex-direction: column; gap: 12px; }
.footer-inner p { max-width: 80ch; }
.footer-inner nav { display: flex; gap: 20px; }
.footer-inner a { color: var(--dim); }

@media (max-width: 960px) {
  .container { padding: 0 16px; }
  nav.main { display: none; }
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .filters-toggle { display: inline-flex; justify-self: start; }
  .filters { display: none; position: static; }
  .filters.open { display: flex; }
  .page { padding-top: 24px; }
}
@media (max-width: 520px) {
  .header-inner .btn { padding: 8px 12px; font-size: 12px; }
  .grid { grid-template-columns: 1fr; }
  .sort { width: 100%; }
  .sort select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* светлая тема арендатора */
[data-theme="light"] {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --panel-2: #efefec;
  --line: #e2e2dd;
  --line-2: #cdcdc6;
  --text: #111111;
  --muted: #7a7a74;
  --dim: #55554f;
  --header-bg: rgba(246,246,243,.9);
}
[data-theme="light"] .btn:hover { border-color: #aaa; }
[data-theme="light"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%2355554f' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E"); }

/* логотип арендатора и скрытие элементов Altezza на чужих сайтах */
.logo img, .footer-inner .flogo img { display: block; max-height: 36px; width: auto; }
body:not([data-tenant="altezza"]) .altezza-only { display: none !important; }
.brand-name { font-weight: 800; letter-spacing: -.02em; }

/* заглушка приостановленного арендатора */
.stub { flex: 1; display: grid; place-items: center; padding: 80px 0; text-align: center; }
.stub h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.03em; margin-bottom: 12px; }
.stub p { color: var(--dim); max-width: 48ch; margin: 0 auto 24px; }
body[data-suspended] main.page { display: none; }

/* окно заявки */
dialog { margin: auto; width: min(460px, calc(100vw - 32px)); padding: 0; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form, .lead-done { display: flex; flex-direction: column; gap: 8px; padding: 24px; }
dialog h2 { font-size: 20px; letter-spacing: -.02em; margin-bottom: 2px; }
.lead-lot { font: 400 12px var(--mono); color: var(--muted); margin-bottom: 8px; }
dialog label { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
dialog input[type="text"], dialog textarea { width: 100%; padding: 10px 12px; font: 400 14px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); }
dialog textarea { resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.lead-error { color: #ff6b5e; font-size: 13px; }
.lead-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.lead-done p { color: var(--dim); }
.lead-done .btn { align-self: flex-start; }
