:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef3ea;
  --ink: #1d2420;
  --muted: #667169;
  --line: #dce2d9;
  --primary: #146c43;
  --primary-dark: #0e4f31;
  --accent: #f2b84b;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(26, 45, 36, 0.12);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  align-items: center;
  background: rgba(246, 247, 244, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px clamp(16px, 5vw, 56px);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.desktop-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  bottom: 0;
  display: none;
  flex-direction: column;
  gap: 18px;
  left: 0;
  overflow-y: auto;
  padding: 18px;
  position: fixed;
  top: 0;
  width: 280px;
  z-index: 25;
}

.sidebar-brand {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
}

.sidebar-brand h1 {
  font-size: 1rem;
}

.sidebar-brand small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.sidebar-section {
  background: #f8faf7;
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.sidebar-section h2,
.sidebar-section-head h2 {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.sidebar-section-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.sidebar-section label {
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  font-weight: 800;
  gap: 6px;
}

.sidebar-section input {
  border: 1px solid var(--line);
  min-height: 36px;
  outline: 0;
  padding: 0 9px;
  width: 100%;
}

.text-action {
  background: transparent;
  border: 0;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0;
}

.save-confirm {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  margin: 0;
}

.category-nav {
  display: grid;
  gap: 6px;
}

.category-nav button {
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  min-height: 36px;
  padding: 0 10px;
  text-align: left;
}

.category-nav button.active {
  background: #e8f5ee;
  border-left-color: var(--primary);
  color: var(--primary);
}

.full-width {
  width: 100%;
}

.danger-button {
  background: #fff5f3;
  border: 1px dashed #f3b5ad;
  color: var(--danger);
  font-weight: 800;
  margin-top: auto;
  min-height: 40px;
}

body:not(.admin-mode) #settingsButton,
body:not(.admin-mode) .sidebar-section:first-of-type,
body:not(.admin-mode) #resetDemoButton {
  display: none;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand-mark {
  align-items: center;
  aspect-ratio: 1;
  background: var(--primary);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  width: 46px;
}

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

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

h1 {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  margin-bottom: 0;
}

main {
  margin: 0 auto;
  max-width: 1240px;
  padding: 26px clamp(16px, 5vw, 56px) 120px;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 260px;
  margin-bottom: 24px;
}

.hero-copy {
  background:
    linear-gradient(90deg, rgba(20, 108, 67, 0.92), rgba(20, 108, 67, 0.76)),
    url("https://images.unsplash.com/photo-1556745757-8d76bdb6984b?auto=format&fit=crop&w=1600&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
  min-height: 250px;
  padding: clamp(24px, 5vw, 46px);
}

.hero-copy .eyebrow {
  color: #f9d978;
}

.hero-copy h2 {
  font-size: clamp(2rem, 4.2vw, 4rem);
  line-height: 1.02;
  margin-bottom: 14px;
  max-width: 820px;
}

.hero-copy p {
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  line-height: 1.6;
  margin-bottom: 0;
  max-width: 680px;
}

.hero-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
}

.hero-panel span,
.hero-panel small {
  color: var(--muted);
  font-weight: 600;
}

.hero-panel strong {
  color: var(--primary);
  display: block;
  font-size: 4rem;
  line-height: 1;
  margin: 10px 0;
}

.controls {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 220px) auto;
  margin-bottom: 20px;
}

.search {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
}

.search svg,
.icon-button svg,
.floating-cart svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.search svg {
  color: var(--muted);
  width: 20px;
}

.search input,
.settings input {
  border: 0;
  color: var(--ink);
  min-width: 0;
  outline: 0;
  width: 100%;
}

select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 50px;
  padding: 0 14px;
}

.segmented {
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
}

.segmented button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
}

.segmented button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 5px 14px rgba(26, 45, 36, 0.08);
}

.status {
  background: #fff7e6;
  border: 1px solid #f5d596;
  color: #7a4b00;
  margin-bottom: 20px;
  padding: 14px 16px;
}

.mode-banner {
  align-items: center;
  background: var(--ink);
  color: #fff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 16px;
}

.mode-banner .eyebrow {
  color: #73d99c;
}

.mode-banner p:last-child {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0;
}

.mode-banner strong {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  padding: 8px 10px;
  white-space: nowrap;
}

.summary-strip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 0.86rem;
  font-weight: 700;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 14px;
}

.catalog {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.product-media {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  display: block;
  overflow: hidden;
  position: relative;
}

.product-media img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.badge {
  background: var(--accent);
  color: #3e2b00;
  font-size: 0.72rem;
  font-weight: 800;
  left: 10px;
  padding: 5px 8px;
  position: absolute;
  top: 10px;
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.sku {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.product-card h3 {
  font-size: 1rem;
  line-height: 1.35;
  margin-bottom: 0;
}

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82rem;
  gap: 8px;
}

.price-row {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.price-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.price-row strong {
  color: var(--primary);
  font-size: 1.25rem;
}

.product-note {
  background: #fff7e6;
  border: 1px solid #f5d596;
  color: #7a4b00;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 0;
  padding: 8px 10px;
}

.qty-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 34px 1fr 34px;
}

.qty-row button,
.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
}

.qty-row button {
  aspect-ratio: 1;
  font-size: 1.2rem;
  font-weight: 700;
}

.qty-row input {
  border: 1px solid var(--line);
  min-height: 34px;
  text-align: center;
  width: 100%;
}

.add-button,
.primary-button,
.secondary-button {
  border: 0;
  font-weight: 800;
  min-height: 44px;
  padding: 0 16px;
}

.add-button,
.primary-button {
  background: var(--primary);
  color: #fff;
}

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

.secondary-button {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-button {
  aspect-ratio: 1;
  border-radius: 8px;
  min-width: 42px;
}

.refresh-button {
  justify-self: end;
  width: 50px;
}

.icon-button svg,
.floating-cart svg {
  width: 20px;
}

.cart {
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 420px;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform 0.22s ease;
  width: min(100vw, 420px);
  z-index: 40;
}

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

.cart-header,
.settings-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px;
}

.cart-header h2,
.settings-head h2 {
  margin-bottom: 0;
}

.cart-items {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 18px;
}

.cart-line {
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.cart-line-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.cart-line strong {
  display: block;
  margin-bottom: 4px;
  line-height: 1.25;
}

.cart-line small {
  color: var(--muted);
}

.cart-remove,
.cart-qty-row button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
}

.cart-remove {
  border-color: #efd1cc;
  color: var(--danger);
  flex: 0 0 36px;
  height: 36px;
  padding: 0;
}

.cart-remove svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.cart-qty-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 38px 1fr 38px;
}

.cart-qty-row button {
  aspect-ratio: 1;
  font-size: 1.15rem;
  font-weight: 800;
}

.cart-qty-row button:disabled {
  color: #b3bbb5;
  cursor: not-allowed;
  opacity: 0.65;
}

.cart-qty-row span {
  background: #f8faf7;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
  min-height: 38px;
  padding: 8px 10px;
  text-align: center;
}

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

.cart-total {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.cart-total span {
  color: var(--muted);
  font-weight: 600;
}

.floating-cart {
  align-items: center;
  background: var(--primary);
  border: 0;
  border-radius: 999px;
  bottom: 22px;
  box-shadow: var(--shadow);
  color: #fff;
  display: inline-flex;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px;
  position: fixed;
  right: 22px;
  z-index: 30;
}

.floating-cart span {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-weight: 800;
  min-width: 28px;
  padding: 4px 8px;
}

.settings {
  border: 0;
  box-shadow: var(--shadow);
  max-width: 620px;
  padding: 0;
  width: calc(100vw - 32px);
}

.settings::backdrop {
  background: rgba(29, 36, 32, 0.46);
}

.settings-content {
  display: grid;
  gap: 18px;
}

.settings label {
  color: var(--muted);
  display: grid;
  font-size: 0.88rem;
  font-weight: 700;
  gap: 8px;
  padding: 0 18px;
}

.settings input {
  border: 1px solid var(--line);
  min-height: 46px;
  padding: 0 12px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  justify-content: end;
  padding: 0 18px 18px;
}

.sheet-guide {
  background: #f8faf7;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding: 16px 18px 18px;
}

.sheet-guide h3 {
  font-size: 0.95rem;
  margin: 0;
}

.sheet-guide code {
  background: var(--surface);
  border: 1px solid var(--line);
  display: block;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  padding: 10px;
}

.sheet-guide p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  margin-bottom: 0;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
}

@media (max-width: 760px) {
  .hero,
  .controls {
    grid-template-columns: 1fr;
  }

  .refresh-button {
    justify-self: end;
    min-height: 50px;
    width: 50px;
  }

  .hero-copy {
    min-height: 320px;
  }

  .hero-panel {
    display: none;
  }

  .settings-actions {
    flex-direction: column;
  }

  .mode-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-banner strong {
    text-align: center;
    white-space: normal;
  }
}

@media (min-width: 980px) {
  .desktop-sidebar {
    display: flex;
  }

  .topbar,
  main {
    margin-left: 280px;
  }

  .topbar {
    padding-left: 28px;
  }
}
