:root {
  color-scheme: light;
  --ink: #151514;
  --muted: #66645f;
  --line: #dedbd3;
  --panel: #ffffff;
  --base: #f4f2ed;
  --accent: #166b5b;
  --accent-dark: #0f4f43;
  --warn: #9a3412;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #b6b0a6;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
  background: rgba(244, 242, 237, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.cart-button span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
}

.shop-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.catalog-head,
.admin-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
}

.catalog-meta,
.message,
.muted {
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.product-card,
.admin-login,
.product-form,
.admin-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.product-card {
  display: grid;
  overflow: hidden;
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: linear-gradient(135deg, #e8e2d7, #cddbd5);
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.product-title {
  margin: 0;
  font-size: 18px;
}

.product-price {
  font-size: 20px;
  font-weight: 800;
}

.product-description {
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.cart-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 20;
  width: min(440px, 100%);
  padding: 20px;
  background: #fff;
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 180ms ease;
  overflow: auto;
}

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

.cart-header,
.cart-line,
.admin-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.cart-items {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.cart-line {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-controls button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.checkout-form,
.product-form {
  display: grid;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.admin-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.admin-login {
  width: min(420px, 100%);
  margin: 64px auto;
  padding: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.product-form {
  padding: 16px;
}

.product-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-form .check {
  display: flex;
  align-items: center;
}

.product-form .check input {
  width: auto;
}

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

.admin-list-item {
  padding: 14px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.empty {
  border: 1px dashed #c8c0b4;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.hidden {
  display: none !important;
}

.danger {
  color: var(--warn);
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
  }

  .catalog-head,
  .admin-toolbar {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }
}
