:root {
  --ink: #182127;
  --muted: #6e797d;
  --paper: #f7f5f0;
  --card: #fffdf8;
  --line: #dedfd8;
  --gold: #c99b55;
  --gold-dark: #8c632c;
  --sage: #b7c5b2;
  --night: #182127;
  --danger: #b34c3e;
  font-family: 'Avenir Next', 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.site-shell { min-height: 100vh; overflow: hidden; }
.topbar { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 14px; letter-spacing: .02em; }
.brand-copy span { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.topbar nav { display: flex; align-items: center; gap: 16px; font-size: 13px; font-weight: 700; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--ink); }
.editor-link { padding: 10px 14px; color: var(--ink) !important; border: 1px solid var(--line); border-radius: 999px; background: #ffffff90; }

.catalog-wrap { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 18px 0 100px; }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; }
.result-count { margin-top: 8px; }
.toolbar-left { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.count { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.filter { padding: 9px 13px; border: 1px solid transparent; border-radius: 999px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.filter:hover, .filter.active { border-color: var(--ink); color: #fff; background: var(--ink); }
.search { width: 220px; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; outline: none; color: var(--ink); background: #fffdf8; font-size: 13px; }
.search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #c99b5528; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding-top: 28px; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 35px #1c2a3012; }
.card-image { position: relative; aspect-ratio: 1 / .88; overflow: hidden; background: #e7e5df; }
.card-image img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .45s ease; }
.card:hover .card-image img { transform: scale(1.035); }
.card-number { position: absolute; top: 12px; left: 12px; padding: 6px 8px; border-radius: 999px; color: #fff; background: #182127c9; font-family: 'DM Mono', monospace; font-size: 10px; }
.sold-badge { position: absolute; right: 12px; bottom: 12px; padding: 8px 10px; border: 1px solid #fff8; border-radius: 999px; color: #fff; background: #182127e8; font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.card-body { min-height: 142px; padding: 17px 17px 16px; display: flex; flex-direction: column; }
.card-kicker { margin-bottom: 7px; color: var(--gold-dark); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.card h2 { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -.035em; }
.card-description { min-height: 20px; margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.card-foot { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 15px; }
.price { color: var(--ink); font-size: 15px; font-weight: 800; letter-spacing: -.03em; }
.price.pending { color: var(--muted); font-size: 11px; font-weight: 600; }
.price.sold-price { color: var(--danger); }
.view-link { color: var(--muted); font-size: 11px; font-weight: 700; }
.empty { grid-column: 1 / -1; padding: 70px 20px; text-align: center; color: var(--muted); }

.admin-panel[hidden] { display: none !important; }
.admin-panel { display: grid; gap: 16px; margin-bottom: 28px; padding: 22px; border: 1px solid #cbd4cc; border-radius: 20px; background: #eef2eb; }
.admin-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.admin-head h2 { margin: 0; font-size: 24px; letter-spacing: -.05em; }
.admin-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.admin-actions { display: flex; gap: 8px; }
.small-button { height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fffdf8; font-size: 12px; font-weight: 800; }
.small-button.dark { color: #fff; border-color: var(--ink); background: var(--ink); }
.admin-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { padding: 9px 12px; border-radius: 10px; background: #ffffff90; color: var(--muted); font-family: 'DM Mono', monospace; font-size: 11px; }
.stat strong { color: var(--ink); }
.admin-list { display: grid; gap: 8px; }
.admin-row { display: grid; grid-template-columns: 54px minmax(170px, 1fr) 130px minmax(80px, 140px) auto; gap: 12px; align-items: center; padding: 9px; border: 1px solid #dce3dc; border-radius: 13px; background: #fffdf8; }
.admin-row.removed { opacity: .68; }
.admin-thumb { width: 54px; height: 54px; border-radius: 9px; object-fit: cover; background: #e7e5df; }
.admin-name { min-width: 0; }
.admin-name strong, .admin-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-name strong { font-size: 13px; }
.admin-name span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.price-input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none; font-size: 13px; }
.price-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #c99b5528; }
.note-input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none; color: var(--muted); font-size: 11px; }
.row-actions { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 6px; }
.sold-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.sold-toggle input { accent-color: var(--danger); }
.row-button { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 800; }
.row-button.save { color: #496047; border-color: #b9cdb7; background: #edf5eb; }
.row-button.remove { color: var(--danger); border-color: #e2bdb7; background: #fff6f4; }
.row-button.restore { color: #496047; border-color: #b9cdb7; background: #edf5eb; }

footer { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 40px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: 320px; padding: 12px 15px; border-radius: 11px; color: #fff; background: var(--ink); box-shadow: 0 12px 30px #0003; font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-row { grid-template-columns: 54px minmax(150px, 1fr) 120px auto; }
  .note-input { display: none; }
}
@media (max-width: 680px) {
  .topbar, .catalog-wrap, footer { width: min(100% - 28px, 1240px); }
  .topbar { padding: 16px 0; }
  .topbar nav a:not(.editor-link) { display: none; }
  .catalog-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-left { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter { white-space: nowrap; }
  .search { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 18px; }
  .card { border-radius: 13px; }
  .card-body { min-height: 132px; padding: 13px 12px 13px; }
  .card h2 { font-size: 14px; }
  .card-description { font-size: 11px; }
  .admin-panel { padding: 15px; }
  .admin-head { align-items: start; flex-direction: column; }
  .admin-row { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 8px; }
  .admin-thumb { width: 46px; height: 46px; }
  .admin-name { grid-column: 2 / -1; grid-row: 1; }
  .price-input { grid-column: 1 / 3; grid-row: 2; }
  .row-actions { grid-column: 3; grid-row: 2; }
  footer { flex-direction: column; }
}
