:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #65716a;
  --line: #dde5df;
  --paper: #f7f7f2;
  --surface: #ffffff;
  --accent: #8f2e24;
  --accent-dark: #661d16;
  --green: #315f4b;
  --shadow: 0 18px 40px rgba(23, 33, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 36px);
  background: rgba(247, 247, 242, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 1.35rem;
}

.cart-toggle,
.primary,
.secondary,
.add,
.icon-button {
  border: 0;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.edit-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 850;
  text-decoration: none;
}

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
}

.cart-toggle strong {
  display: grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border-radius: 50%;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 32px) 32px;
}

.catalog-panel {
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 12px;
  margin-bottom: 14px;
}

.search,
.filter,
.actions label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.summary-line {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.product-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(23, 33, 28, 0.04);
}

.product-card.is-sold-out {
  opacity: 0.62;
  background: #f7f8f5;
}

.product-card.is-sold-out .image-button img {
  filter: grayscale(0.45) brightness(1.12);
}

.image-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  background: #eef1ec;
  border: 0;
}

.image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.image-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  color: #fff;
  background: rgba(23, 33, 28, 0.78);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.sold-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  display: none;
  padding: 5px 9px;
  color: #fff;
  background: rgba(143, 46, 36, 0.9);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.product-card.is-sold-out .sold-badge {
  display: inline-flex;
}

.product-card.has-symbol-image .image-button {
  background: #eef1ec;
}

.thumb-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 56px;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.thumb-strip:empty {
  display: none;
}

.thumb-button {
  width: 56px;
  height: 56px;
  padding: 0;
  overflow: hidden;
  background: #e9ede8;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.thumb-button.is-active {
  border-color: var(--accent);
}

.thumb-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-content {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.product-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.product-number {
  color: var(--accent);
}

.product-card h2 {
  min-height: 44px;
  font-size: 1rem;
}

.product-details {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.product-details[hidden] {
  display: none;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.facts div {
  padding: 10px;
  background: #f3f4ee;
  border-radius: 6px;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

dd {
  margin: 3px 0 0;
  font-weight: 850;
}

.actions {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: end;
  gap: 10px;
}

.add,
.primary {
  min-height: 44px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  font-weight: 850;
}

.add:hover,
.primary:hover {
  background: var(--accent-dark);
}

.add:disabled,
.primary:disabled {
  color: #65716a;
  background: #eef1ec;
  cursor: default;
}

.cart-panel {
  position: sticky;
  top: 88px;
  align-self: start;
  display: grid;
  grid-template-rows: auto minmax(160px, 1fr) auto;
  max-height: calc(100vh - 112px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.cart-head,
.cart-footer {
  padding: 16px;
}

.cart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.cart-head h2 {
  font-size: 1.15rem;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: #eef1ec;
  border-radius: 6px;
  font-size: 1.6rem;
  line-height: 1;
}

.cart-items {
  overflow: auto;
  padding: 10px 14px;
}

.empty {
  padding: 28px 8px;
  color: var(--muted);
  text-align: center;
}

.cart-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #e9ede8;
  border-radius: 6px;
}

.cart-item h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.cart-item-controls {
  display: grid;
  grid-template-columns: 86px minmax(86px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.cart-item-controls input {
  min-height: 36px;
}

.line-total {
  font-weight: 850;
  text-align: right;
}

.remove {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--accent);
  background: #f5e8e5;
  cursor: pointer;
}

.cart-footer {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.contact-form {
  display: grid;
  gap: 8px;
}

.contact-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.privacy-consent {
  grid-template-columns: 22px 1fr;
  align-items: start;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.privacy-consent input {
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
}

.privacy-consent a {
  color: var(--accent);
  font-weight: 850;
}

textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  font: inherit;
}

.send-status {
  min-height: 20px;
  margin: 0;
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 800;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 1rem;
}

.total-row strong {
  font-size: 1.35rem;
}

.secondary {
  min-height: 42px;
  color: var(--ink);
  background: #eef1ec;
  border-radius: 6px;
  font-weight: 800;
}

.admin-layout {
  width: min(1000px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 32px) 42px;
}

.admin-bar {
  position: sticky;
  top: 77px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0 18px;
  background: var(--paper);
}

.admin-bar .search {
  flex: 1 1 260px;
}

.admin-bar .password-field {
  flex: 0 1 220px;
}

.admin-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.editor-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.editor-card img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  background: #e9ede8;
  border-radius: 6px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 80px minmax(240px, 1fr) 90px 110px 110px;
  gap: 10px;
}

.editor-grid label:nth-child(6) {
  grid-column: 2 / -1;
}

.editor-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.editor-card textarea {
  width: 100%;
  min-height: 68px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  font: inherit;
}

.wide-field {
  grid-column: 1 / -1;
}

.editor-card-actions {
  display: flex;
  justify-content: flex-end;
  grid-column: 1 / -1;
}

.danger-button {
  min-height: 40px;
  padding: 0 12px;
  color: #8f2e24;
  background: #f5e8e5;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.danger-button:hover {
  background: #ead4cf;
}

.status-line {
  min-height: 22px;
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 800;
}

.privacy-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 4vw, 34px) 48px;
}

.privacy-hero {
  padding: clamp(22px, 5vw, 42px);
  color: #fff;
  background: var(--green);
  border-radius: 8px;
}

.privacy-hero .eyebrow {
  color: #dceade;
}

.privacy-hero h2 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.05;
}

.privacy-hero p {
  max-width: 760px;
  margin: 16px 0 0;
  color: #edf5ef;
  font-size: 1.05rem;
  line-height: 1.55;
}

.privacy-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.privacy-summary article,
.privacy-card,
.privacy-contact {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(23, 33, 28, 0.04);
}

.privacy-summary article {
  padding: 16px;
}

.privacy-summary span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.privacy-summary strong {
  display: block;
  line-height: 1.35;
}

.privacy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.privacy-card,
.privacy-contact {
  padding: clamp(16px, 3vw, 24px);
}

.privacy-card h2,
.privacy-contact h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.privacy-card p,
.privacy-contact p,
.privacy-card li {
  color: var(--muted);
  line-height: 1.58;
}

.privacy-card p,
.privacy-contact p {
  margin: 0 0 10px;
}

.privacy-card p:last-child,
.privacy-contact p:last-child {
  margin-bottom: 0;
}

.privacy-card ul {
  margin: 0;
  padding-left: 18px;
}

.privacy-card a,
.privacy-contact a {
  color: var(--accent);
  font-weight: 850;
}

.privacy-address {
  margin: 10px 0;
  padding: 12px;
  color: var(--ink);
  background: #f3f4ee;
  border-radius: 6px;
  font-style: normal;
  line-height: 1.55;
}

.privacy-note {
  padding: 10px 12px;
  color: var(--accent) !important;
  background: #f5e8e5;
  border-radius: 6px;
  font-weight: 750;
}

.privacy-contact {
  margin-top: 14px;
}

.overlay {
  display: none;
}

dialog {
  width: min(920px, calc(100% - 28px));
  padding: 0;
  overflow: hidden;
  background: #111714;
  border: 0;
  border-radius: 8px;
}

dialog::backdrop {
  background: rgba(23, 33, 28, 0.72);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  width: 44px;
  height: 54px;
  place-items: center;
  color: #fff;
  background: rgba(17, 23, 20, 0.74);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 2.4rem;
  line-height: 1;
  transform: translateY(-50%);
}

.gallery-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.gallery-prev {
  left: 12px;
}

.gallery-next {
  right: 12px;
}

#dialogImage {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
}

.dialog-caption {
  padding: 12px 16px;
  color: #fff;
  background: #111714;
  font-weight: 750;
}

@media (max-width: 900px) {
  body {
    background: #fff;
    overflow-x: hidden;
  }

  .layout {
    display: block;
    padding: 12px 10px 84px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
  }

  .cart-panel {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    max-height: 92dvh;
    border-radius: 12px 12px 0 0;
    transform: translateY(105%);
    transition: transform 180ms ease;
  }

  .cart-panel.is-open {
    transform: translateY(0);
  }

  .overlay.is-open {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    background: rgba(23, 33, 28, 0.45);
  }

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

  .app-header {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .edit-link,
  .cart-toggle {
    justify-content: center;
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .product-content {
    gap: 9px;
    padding: 10px;
  }

  .product-card h2 {
    min-height: auto;
    font-size: 1.02rem;
  }

  .facts {
    gap: 6px;
  }

  .facts div {
    padding: 8px;
  }

  dd {
    font-size: 1rem;
  }

  .actions {
    grid-template-columns: 86px 1fr;
    gap: 8px;
  }

  .image-button {
    aspect-ratio: 4 / 3;
  }

  .thumb-strip {
    grid-auto-columns: 48px;
    gap: 6px;
  }

  .thumb-button {
    width: 48px;
    height: 48px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .cart-head {
    padding: 12px 14px;
  }

  .cart-items {
    padding: 8px 14px;
  }

  .cart-footer {
    max-height: 52dvh;
    overflow: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .contact-form {
    gap: 7px;
  }

  .cart-item {
    grid-template-columns: 46px 1fr;
    gap: 9px;
  }

  .cart-item img {
    width: 46px;
    height: 46px;
  }

  .cart-item h3 {
    font-size: 0.86rem;
  }

  .cart-item-controls {
    grid-template-columns: 72px minmax(76px, 1fr) 34px;
  }

  .cart-item-controls input {
    min-height: 38px;
  }

  .editor-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .editor-card img {
    width: 72px;
    height: 72px;
  }

  .editor-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .wide-field,
  .editor-grid label:nth-child(2) {
    grid-column: 1 / -1;
  }

  .privacy-page {
    padding: 12px 10px 34px;
  }

  .privacy-hero {
    padding: 20px;
  }

  .privacy-hero h2 {
    font-size: 1.65rem;
  }

  .privacy-summary,
  .privacy-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

}

@media (min-width: 901px) {
  #closeCart {
    display: none;
  }
}
