:root {
  --bg: #f4f4f6;
  --card: #ffffff;
  --text: #161616;
  --muted: #777;
  --accent: #9d4edd;
  --ok: #2b9348;
  --danger: #c1121f;
  --line: #e8e8ee;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top right, #fbe8ff, #f4f4f6 40%);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, sans-serif;
}

.container {
  width: min(1100px, 94%);
  margin: 24px auto 60px;
}

h1, h2, h3 { margin: 0 0 12px; }
a { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 8px 20px rgba(35, 35, 35, 0.04);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: var(--muted);
  gap: 6px;
}

input, button {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font: inherit;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-form input { flex: 1 1 280px; }
.single-add-form button { min-width: 180px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.product-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px;
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  background: #f3f3f3;
}

.product-card.selectable { cursor: pointer; }
.product-card.selectable input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 4px;
}
.product-card.selectable .check-col {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
  width: 22px;
}
.product-card.selectable {
  grid-template-columns: 22px 140px 1fr;
}

.product-content h3 {
  font-size: 22px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.meta {
  color: var(--muted);
  margin: 0 0 8px;
}

.price {
  font-size: 34px;
  font-weight: 700;
  margin: 8px 0;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffe4e6;
  color: var(--danger);
  font-size: 13px;
}

.badge.free {
  background: #def7e5;
  color: var(--ok);
}

.reserved {
  opacity: 0.75;
}
.unpublished {
  border-style: dashed;
}

.owner-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.owner-actions form {
  margin: 0;
}
.owner-actions button {
  min-width: 0;
}

button.secondary {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
}
button.danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.filter-toolbar {
  display: flex;
  gap: 8px;
  margin: 8px 0 8px;
  flex-wrap: wrap;
}

.button-link {
  display: inline-block;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
}

.filter-toolbar .secondary,
.button-link.secondary {
  padding: 8px 12px;
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
}

.filter-toolbar .secondary.active,
.button-link.secondary.active {
  background: var(--accent);
  color: #fff;
}

.reserve-filter-btn {
  border: none;
  cursor: pointer;
  text-align: left;
}

.sticky-total {
  position: sticky;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flash-list { margin-bottom: 12px; }
.flash {
  border-radius: 10px;
  border: 1px solid #f2d6a9;
  background: #fff8e7;
  color: #5f4600;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.flash.error {
  border-color: #f5b7b1;
  background: #fff1f0;
  color: #8a1f17;
}
.flash.success {
  border-color: #b7e4c7;
  background: #effaf3;
  color: #165f2e;
}

@media (max-width: 720px) {
  .container {
    width: min(100%, 96%);
    margin: 12px auto 24px;
  }
  .card {
    padding: 12px;
    border-radius: 12px;
    margin: 10px 0;
  }
  h1 { font-size: 26px; }
  h2 { font-size: 24px; }
  h3 { font-size: 19px; }

  .inline-form {
    gap: 8px;
  }
  .inline-form input,
  .inline-form button {
    width: 100%;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .product-card {
    grid-template-columns: 110px 1fr;
    gap: 10px;
    padding: 10px;
  }
  .product-card img {
    height: 140px;
    border-radius: 8px;
  }
  .product-content h3 {
    font-size: 20px;
    margin-bottom: 4px;
  }
  .price {
    font-size: 24px;
    margin: 4px 0 8px;
  }
  .meta {
    margin: 0 0 4px;
  }
  .badge {
    font-size: 12px;
    padding: 5px 9px;
  }

  .owner-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
  }
  .owner-actions form {
    width: 100%;
  }
  .owner-actions button {
    width: 100%;
    padding: 10px 8px;
    font-size: 14px;
  }
  .product-card.selectable {
    grid-template-columns: 22px 110px 1fr;
  }
  .product-card.selectable .check-col {
    width: 22px;
    padding-top: 2px;
  }
  .product-card.selectable input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .sticky-total {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }
  .single-add-form button {
    width: 100%;
  }
  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-toolbar {
    width: 100%;
  }
  .filter-toolbar .secondary {
    flex: 1 1 calc(33.33% - 6px);
    text-align: center;
  }
}
