:root {
  --bg: #fff3e4;
  --paper: #ffffff;
  --ink: #17141f;
  --muted: #6e6878;
  --pink: #ff5d8f;
  --yellow: #ffd23f;
  --mint: #6ee7b7;
  --sky: #8ec5ff;
  --lilac: #c3b1ff;
  --line: 2px solid var(--ink);
  --shadow: 3px 3px 0 var(--ink);
  --shadow-lg: 5px 5px 0 var(--ink);
  --radius: 18px;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.4 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background-image: radial-gradient(rgba(23, 20, 31, 0.07) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  font-weight: 700;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

main {
  position: relative;
  padding: calc(14px + var(--safe-top)) 16px calc(112px + var(--safe-bottom));
  min-height: 100vh;
}

h1 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 6px 0 18px;
}

.muted {
  color: var(--muted);
}

.ink {
  color: var(--ink);
}

.hint {
  text-align: center;
  font-size: 13px;
  margin-top: 12px;
}

.label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--shadow);
  flex: none;
}

.icon-btn.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: none;
}

.icon-btn.small svg {
  width: 18px;
  height: 18px;
}

.icon-btn.spin svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- topbar & hero ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lilac);
  border: var(--line);
  font-weight: 800;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 20px;
  border-radius: 24px;
  background: var(--yellow);
  border: var(--line);
  box-shadow: var(--shadow-lg);
  margin-bottom: 18px;
}

.blob {
  position: absolute;
  border-radius: 50%;
  border: var(--line);
}

.blob-pink {
  width: 120px;
  height: 120px;
  right: -34px;
  top: -40px;
  background: var(--pink);
}

.blob-mint {
  width: 56px;
  height: 56px;
  right: 58px;
  top: 52px;
  background: var(--mint);
}

.sticker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper);
  border: var(--line);
  font-size: 13px;
  font-weight: 700;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16a34a;
  border: 1.5px solid var(--ink);
}

.hero h2 {
  position: relative;
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 34px 0 8px;
  max-width: 85%;
}

.hero p {
  position: relative;
  margin: 0;
  font-weight: 600;
  max-width: 92%;
}

/* ---------- search & chips ---------- */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 52px;
  border-radius: 16px;
  background: var(--paper);
  border: var(--line);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-weight: 600;
}

.search input::placeholder {
  color: var(--muted);
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 14px -16px 18px;
  padding: 2px 16px 4px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--paper);
  border: var(--line);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chip small {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  text-align: center;
}

.chip.active {
  background: var(--ink);
  color: var(--yellow);
}

.chip.active small {
  background: var(--yellow);
  color: var(--ink);
}

/* ---------- product grid ---------- */

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

.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.card:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.card.out {
  opacity: 0.55;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
}

.card .thumb {
  border-bottom: var(--line);
}

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

.placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--paper);
  border: var(--line);
  transform: rotate(-3deg);
}

.badge.hot {
  background: var(--pink);
  color: #fff;
}

.card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.brand {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.25;
  margin-top: 2px;
}

.card-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.price {
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
}

.add-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border: var(--line);
  flex: none;
}

.add-btn:disabled {
  background: var(--bg);
  color: var(--muted);
}

.add-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.6;
}

/* ---------- empty state ---------- */

.empty {
  text-align: center;
  padding: 24px 20px;
}

.empty-icon {
  width: 104px;
  height: 104px;
  margin: 0 auto 22px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: var(--lilac);
  border: var(--line);
  box-shadow: var(--shadow-lg);
  transform: rotate(-4deg);
}

.empty-icon svg {
  width: 48px;
  height: 48px;
}

.empty h3 {
  font-family: var(--display);
  margin: 0 0 8px;
  font-size: 19px;
}

.empty p {
  margin: 0 auto 22px;
  max-width: 300px;
  color: var(--muted);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  padding: 0 22px;
  border-radius: 16px;
  background: var(--pink);
  color: var(--ink);
  border: var(--line);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 16px;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn.block {
  width: 100%;
}

.btn.secondary {
  background: var(--paper);
}

.btn.danger {
  background: var(--paper);
  color: #dc2626;
  border-color: #dc2626;
  box-shadow: 3px 3px 0 #dc2626;
}

.btn.small {
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 12px;
}

.btn:disabled {
  opacity: 0.55;
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

/* ---------- lists & rows ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--shadow);
  text-align: left;
  width: 100%;
}

.row .thumb {
  width: 64px;
  flex: none;
  border-radius: 12px;
  border: var(--line);
}

.row .placeholder {
  font-size: 18px;
}

.row-info {
  flex: 1;
  min-width: 0;
}

.row-info .name {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-info .variant {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.row-info .price {
  font-size: 15px;
  margin-top: 2px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg);
  border: var(--line);
  flex: none;
}

.stepper button {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.stepper button:active {
  background: var(--yellow);
}

.stepper button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}

.stepper span,
.stepper input {
  min-width: 24px;
  text-align: center;
  font-weight: 800;
}

.stepper input {
  width: 44px;
  border: 0;
  background: none;
  outline: none;
  -moz-appearance: textfield;
}

.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.section-title {
  font-family: var(--display);
  margin: 26px 0 12px;
  font-size: 18px;
  font-weight: 800;
}

.panel {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--shadow);
}

.delivery-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--yellow);
  border: var(--line);
}

.delivery-note p {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
}

.delivery-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: var(--line);
  flex: none;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px 2px;
}

.field input,
.field textarea,
.variant-row > input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: var(--line);
  background: var(--bg);
  outline: none;
  resize: none;
  font-weight: 600;
}

.field input:focus,
.field textarea:focus,
.variant-row > input:focus {
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--yellow);
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 2px;
  font-weight: 600;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.summary .total {
  color: var(--ink);
  font-family: var(--display);
  font-size: 19px;
  font-weight: 800;
  padding-top: 10px;
  border-top: 2px dashed var(--ink);
}

/* ---------- orders ---------- */

.order {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--shadow);
}

.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.order-head b {
  font-family: var(--display);
  font-size: 16px;
}

.order-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.order-items {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.order-items li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}

.order-total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  padding-top: 10px;
  border-top: 2px dashed var(--ink);
}

.contact {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.order-actions .btn {
  flex: 1;
  box-shadow: none;
}

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: var(--line);
  white-space: nowrap;
}

.status-new { background: var(--yellow); }
.status-paid { background: var(--lilac); }
.status-shipped { background: var(--sky); }
.status-done { background: var(--mint); }
.status-cancelled { background: var(--bg); color: var(--muted); }

/* ---------- success ---------- */

.success {
  text-align: center;
  padding-top: 10px;
}

.success h1 {
  margin-bottom: 6px;
}

.success > p {
  margin: 0;
}

.success-icon {
  background: var(--mint);
}

.pay-box {
  text-align: left;
  margin: 22px 0;
}

.pay-box pre {
  margin: 0 0 14px;
  white-space: pre-wrap;
  font: inherit;
  font-weight: 800;
  font-size: 16px;
}

.pay-box p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- admin ---------- */

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: var(--paper);
  border: var(--line);
  margin-bottom: 16px;
}

.seg button {
  padding: 10px 6px;
  border-radius: 11px;
  font-weight: 800;
  font-size: 14px;
}

.seg button.active {
  background: var(--ink);
  color: var(--yellow);
}

.admin-row.is-hidden {
  opacity: 0.6;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--bg);
  border: var(--line);
  flex: none;
}

.tag svg {
  width: 14px;
  height: 14px;
}

.photo {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: var(--line);
  overflow: hidden;
  background: var(--paper);
  margin-bottom: 12px;
  cursor: pointer;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.empty-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-style: dashed;
  font-weight: 800;
}

.empty-photo svg {
  width: 40px;
  height: 40px;
}

.photo-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.photo-actions .btn {
  flex: 1;
}

.variant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.variant-row > input {
  flex: 1;
  min-width: 0;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 0 20px;
  cursor: pointer;
}

.switch-row p {
  margin: 2px 0 0;
  font-size: 13px;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: var(--line);
  background: var(--bg);
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}

.switch:checked {
  background: var(--pink);
}

.switch:checked::after {
  transform: translateX(22px);
}

/* ---------- tabbar ---------- */

.tabbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  border-radius: 22px;
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--shadow-lg);
}

.tabbar.four {
  grid-template-columns: repeat(4, 1fr);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  border-radius: 16px;
  border: 2px solid transparent;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.tab.active {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--ink);
}

.tab-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pink);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-size: 11px;
  line-height: 16px;
}

/* ---------- sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 20, 31, 0.45);
  animation: fade 0.2s ease;
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 12px 16px calc(20px + var(--safe-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--bg);
  border-top: var(--line);
  animation: up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--ink);
  margin: 0 auto 12px;
}

.sheet .thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: var(--line);
}

.sheet .placeholder {
  font-size: 48px;
}

.sheet-title {
  margin: 16px 0 0;
}

.sheet-title .name {
  font-family: var(--display);
  font-size: 22px;
  margin: 2px 0 4px;
}

.sheet-title .price {
  font-size: 20px;
}

.sheet-desc {
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 0;
}

.sheet .label {
  margin-top: 18px;
}

.variants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-btn {
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--paper);
  border: var(--line);
  font-weight: 800;
  font-size: 14px;
}

.variant-btn small {
  color: var(--muted);
  margin-left: 4px;
}

.variant-btn.active {
  background: var(--ink);
  color: var(--yellow);
}

.variant-btn.active small {
  color: var(--paper);
}

.variant-btn:disabled {
  opacity: 0.4;
  text-decoration: line-through;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}

.sheet-actions .stepper {
  height: 54px;
  padding: 0 6px;
  background: var(--paper);
}

.sheet-actions .btn {
  flex: 1;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + var(--safe-bottom));
  z-index: 30;
  transform: translate(-50%, 20px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--yellow);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes fade {
  from { opacity: 0; }
}

@keyframes up {
  from { transform: translateY(100%); }
}

.fade-in {
  animation: fade 0.2s ease;
}
