:root {
  --yellow: #fdd416;
  --red: #e61b1f;
  --paper: #f7f7f5;
  --line: #dfdfd8;
  --ink: #171717;
  --muted: #5f5f59;
  font: 16px/1.45 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 650;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #9b4c00; outline-offset: 3px; }
.yellow { background: var(--yellow); border-color: #dfb900; }
.wrap { width: min(1040px, calc(100% - 40px)); margin-inline: auto; }
header, .bottom { background: #fff; }
header { border-bottom: 1px solid var(--line); }
.bar, .brand, nav, .actions, .section-title, .bottom-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bar { justify-content: space-between; min-height: 62px; }
.brand { font-size: 14px; font-weight: 800; }
.brand img { width: 36px; height: 36px; border-radius: 50%; }
nav a, .vk, .bottom a { font-size: 14px; font-weight: 650; padding: 8px; }
nav a[aria-current] { text-decoration: underline; text-underline-offset: 5px; text-decoration-color: #987e00; }
small { display: block; color: var(--muted); font-size: 12px; }
.demo { color: var(--muted); font-size: 12px; margin-top: 12px; }
main { padding-bottom: 80px; }
.catalog-heading { margin: 22px 0 16px; }
h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -.035em; margin: 16px 0 6px; }
.catalog-heading p { margin: 0; color: var(--muted); }
h2 { margin: 12px 0; font-size: 24px; letter-spacing: -.02em; }
.period, .panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.period { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.period strong { align-self: center; margin-right: auto; }
.period .error { flex-basis: 100%; }
.filters { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.categories { display: flex; flex-wrap: wrap; gap: 6px; }
.categories button { font-size: 14px; }
.categories button[aria-pressed=true] { background: var(--ink); color: white; }
#search { width: min(100%, 250px); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card { background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo { height: 148px; display: grid; place-items: center; background: #eeeee9; color: var(--muted); font-size: 13px; }
.photo img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.card-body { padding: 12px; }
.card h3 { margin: 4px 0; font-size: 17px; overflow-wrap: anywhere; }
.card p { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.card .stock { font-weight: 650; color: #8b1619; }
.card .stock[data-free=true] { color: #286337; }
.actions { flex-wrap: wrap; gap: 6px; }
.card .actions button { font-size: 13px; }
.bottom { position: fixed; z-index: 2; inset: auto 0 0; border-top: 1px solid var(--line); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.bottom-inner { justify-content: center; gap: clamp(8px, 6vw, 48px); }
.panel { margin: 12px 0; overflow-wrap: anywhere; }
input, select, textarea { width: 100%; min-width: 0; padding: 8px; border: 1px solid #b7b7af; border-radius: 7px; background: white; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.check { display: flex; align-items: center; }
.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.wide, .form-grid h3 { grid-column: 1/-1; }
.form-grid h3, .error { margin: 0; }
.error { color: #a51317; }
.error:empty { display: none; }
dialog { width: min(620px,calc(100% - 24px)); max-height: 90dvh; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
dialog::backdrop { background: #0008; }
.section-title, .row { justify-content: space-between; }
.row { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 8px 0; }
.row input { width: 76px; }
.gallery { display: grid; gap: 8px; margin: 12px 0; }
.gallery img { max-width: 100%; max-height: 240px; object-fit: contain; }
footer { display: none; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px); }
  .bar { flex-wrap: wrap; gap: 4px; padding: 8px 0; }
  nav { order: 3; width: 100%; gap: 4px; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .photo { height: 112px; }
  #search { width: 100%; }
  .period { display: grid; grid-template-columns: 1fr 1fr; }
  .period strong, .period button, .period .error { grid-column: 1/-1; }
}
@media (max-width: 380px) {
  .form-grid { grid-template-columns: 1fr; }
  .card-body { padding: 8px; }
  .card .actions button { flex: 1; }
}
