/* Внутренний инструмент: плотность важнее эффектности, но фото — главное на карточке,
   поэтому сетка держит крупные превью, а текст вокруг них остаётся спокойным. */
:root {
  --ground:#f6f6f3; --surface:#fff; --sunken:#eeeee9;
  --ink:#15191a; --muted:#5d6866; --line:#dfe2dd;
  --accent:#1f6f5c; --sale:#a8552a; --danger:#a33;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:#141617; --surface:#1c1f20; --sunken:#232728;
    --ink:#e8eae7; --muted:#9aa5a2; --line:#2d3233;
    --accent:#6cc6ab; --sale:#e0906a; --danger:#e08080;
  }
}
:root[data-theme="dark"] {
  --ground:#141617; --surface:#1c1f20; --sunken:#232728;
  --ink:#e8eae7; --muted:#9aa5a2; --line:#2d3233;
  --accent:#6cc6ab; --sale:#e0906a; --danger:#e08080;
}

* { box-sizing:border-box; }
body { margin:0; background:var(--ground); color:var(--ink);
  font:15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing:antialiased; }
a { color:var(--accent); }

.nav { display:flex; align-items:center; gap:14px; padding:10px 20px;
       border-bottom:1px solid var(--line); background:var(--surface); }
.nav .brand { font-weight:600; text-decoration:none; color:var(--ink);
              font-family:"Iowan Old Style", Palatino, Georgia, serif; }
.nav .grow { flex:1; }
.nav a { color:var(--muted); text-decoration:none; font-size:14px; }
.nav a:hover { color:var(--accent); }
.nav form { display:inline; }
button, .link { font:inherit; cursor:pointer; color:var(--ink); background:var(--surface);
                border:1px solid var(--line); border-radius:8px; padding:5px 10px; }
.link { border:none; background:none; color:var(--muted); font-size:14px; padding:0; }
button.danger { color:var(--danger); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline:2px solid var(--accent); outline-offset:2px; }

.top { position:sticky; top:0; z-index:4; background:var(--ground);
       border-bottom:1px solid var(--line); padding:12px 20px; }
.sub { margin:0 0 10px; color:var(--muted); font-size:13px; }
.filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
select, input { font:inherit; color:var(--ink); background:var(--surface);
                border:1px solid var(--line); border-radius:8px; padding:6px 9px; }
input[type=number] { width:110px; }
input[type=search] { min-width:190px; }
.check { display:inline-flex; gap:6px; align-items:center; color:var(--muted); font-size:13px; }

main { padding:18px 20px 60px; }
.count { color:var(--muted); font-size:13px; margin:0 0 12px; }
.empty { color:var(--muted); text-align:center; padding:60px 0; }

.cards { list-style:none; margin:0; padding:0; display:grid; gap:14px;
         grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); }
.card { background:var(--surface); border:1px solid var(--line); border-radius:12px;
        overflow:hidden; display:flex; flex-direction:column; }
.card:hover { border-color:var(--accent); }
.shot { position:relative; display:block; aspect-ratio:4/3; background:var(--sunken);
        flex:0 0 auto; min-height:0; overflow:hidden; }
/* картинку выводим из потока: как обычный ребёнок она через min-height:auto
   растягивала карточку под свою натуральную высоту, и вертикальные фото ломали ряд */
.shot img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.noshot { position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
          color:var(--muted); font-size:13px; }
.badge { position:absolute; right:8px; bottom:8px; background:rgba(0,0,0,.62); color:#fff;
         border-radius:999px; padding:2px 8px; font-size:11.5px; }
.body { padding:10px 12px 12px; display:flex; flex-direction:column; gap:6px; }
.price { font-size:17px; font-weight:650; font-variant-numeric:tabular-nums; }
.name { font-size:14px; color:var(--ink); text-decoration:none; }
.name:hover { color:var(--accent); }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip { background:var(--sunken); border-radius:999px; padding:2px 9px; font-size:12px; color:var(--muted); }
.chip.sale { background:color-mix(in srgb, var(--sale) 16%, transparent); color:var(--sale); }
.chip.when { margin-left:auto; background:transparent; }

.pager { display:flex; gap:12px; align-items:center; justify-content:center;
         margin:24px 0 0; color:var(--muted); font-size:13px; }
.pos { font-variant-numeric:tabular-nums; }

/* Модалка: список под ней остаётся на месте вместе с прокруткой и фильтрами */
dialog.sheet { border:none; padding:0; max-width:1000px; width:calc(100% - 32px);
  max-height:88vh; border-radius:14px; background:var(--surface); color:var(--ink);
  box-shadow:0 20px 60px rgba(0,0,0,.28); overflow:hidden; }
dialog.sheet::backdrop { background:rgba(0,0,0,.55); }
.sheet-body { overflow:auto; max-height:88vh; padding:22px 24px 26px; }
dialog.sheet .close { position:absolute; top:10px; right:14px; z-index:2;
  border:none; background:var(--surface); color:var(--muted); font-size:22px;
  line-height:1; padding:2px 8px; border-radius:8px; }
dialog.sheet .gallery { grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); }
dialog.sheet .full { max-height:40vh; overflow:auto; }

.detail { max-width:960px; margin:0 auto; }
.back { display:inline-block; margin-bottom:12px; font-size:14px; }
.gallery { display:grid; gap:8px; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); margin-bottom:16px; }
.gallery img { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:10px; display:block; }
.detail .head { display:flex; flex-wrap:wrap; gap:12px; align-items:baseline; }
.detail .price { font-size:24px; }
.meta { color:var(--muted); font-size:13.5px; }
.contacts { display:flex; gap:12px; flex-wrap:wrap; }
.full { white-space:pre-wrap; font:inherit; background:var(--surface); border:1px solid var(--line);
        border-radius:10px; padding:14px 16px; margin:12px 0; }
.translated summary { cursor:pointer; color:var(--muted); font-size:13.5px; }

.narrow { max-width:420px; margin:60px auto; }
.wide { max-width:1100px; margin:0 auto; }
h1 { font-family:"Iowan Old Style", Palatino, Georgia, serif; font-size:22px; font-weight:600; margin:0 0 14px; }
h2 { font-size:16px; margin:28px 0 10px; }
.stack { display:flex; flex-direction:column; gap:12px; background:var(--surface);
         border:1px solid var(--line); border-radius:12px; padding:18px; }
.stack label { display:flex; flex-direction:column; gap:5px; font-size:13.5px; color:var(--muted); }
.inline { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.hint { color:var(--muted); font-size:13px; }
.problem { color:var(--danger); font-size:14px; margin:0; }
.notice { color:var(--accent); font-size:14px; margin:0; }

.scroller { overflow-x:auto; }
.users { border-collapse:collapse; width:100%; font-size:14px; }
.users th, .users td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); }
.users th { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.users .when { color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.row-actions { display:flex; gap:6px; align-items:center; }
.row-actions form { display:inline; }
