:root {
  --sf-bg: #f4f1ec;
  --sf-surface: #ffffff;
  --sf-text: #1c1917;
  --sf-muted: #78716c;
  --sf-border: #e7e5e4;
  --sf-primary: #1b3a6b;
  --sf-primary-soft: #e6eef7;
  --sf-danger: #b91c1c;
  --sf-radius: 14px;
  --sf-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sf-font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--sf-bg);
  color: var(--sf-text);
  font-family: var(--sf-font);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.sf-app {
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.sf-boot,
.sf-state {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--sf-muted);
}

.sf-boot-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d6d3d1;
  border-top-color: var(--sf-primary);
  border-radius: 50%;
  animation: sf-spin 0.8s linear infinite;
}

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

.sf-state h1 {
  margin: 0;
  color: var(--sf-text);
  font-size: 22px;
}

.sf-header {
  background: var(--sf-surface);
  border-bottom: 1px solid var(--sf-border);
}

.sf-header-cover {
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: #d6d3d1;
}

.sf-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
}

.sf-brand {
  display: flex;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sf-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--sf-primary-soft);
  border: 1px solid var(--sf-border);
}

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

.sf-brand-text {
  min-width: 0;
}

.sf-brand-text h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.sf-tagline,
.sf-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--sf-muted);
  line-height: 1.4;
}

.sf-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.sf-wa-btn .material-icons {
  font-size: 18px;
}

.sf-cats {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  background: rgba(244, 241, 236, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sf-border);
  scrollbar-width: none;
}

.sf-cats::-webkit-scrollbar {
  display: none;
}

.sf-cat-chip {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--sf-border);
  border-radius: 999px;
  background: var(--sf-surface);
  color: var(--sf-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sf-cat-chip.is-active {
  background: var(--sf-primary);
  border-color: var(--sf-primary);
  color: #fff;
}

.sf-content {
  padding: 12px 16px calc(96px + var(--sf-safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sf-section-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.sf-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sf-card {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  background: var(--sf-surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
}

.sf-card:hover {
  border-color: #d6d3d1;
}

.sf-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sf-card-name {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
}

.sf-card-desc {
  margin: 0;
  font-size: 12px;
  color: var(--sf-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sf-card-price {
  margin-top: auto;
  font-size: 14px;
  font-weight: 700;
  color: var(--sf-primary);
}

.sf-card-thumb {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f4;
  flex-shrink: 0;
}

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

.sf-card-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a8a29e;
}

.sf-card-thumb--empty .material-icons {
  font-size: 28px;
}

.sf-cart-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + var(--sf-safe-bottom));
  width: min(688px, calc(100% - 24px));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  background: var(--sf-primary);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(28, 25, 23, 0.22);
}

.sf-cart-bar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
}

.sf-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sf-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}

.sf-sheet-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--sf-surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(28, 25, 23, 0.18);
}

.sf-sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--sf-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sf-sheet-media {
  height: 200px;
  background: #f5f5f4;
}

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

.sf-sheet-body {
  padding: 16px 16px calc(20px + var(--sf-safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sf-sheet-body h2 {
  margin: 0;
  font-size: 20px;
  padding-right: 40px;
}

.sf-sheet-desc {
  margin: 0;
  color: var(--sf-muted);
  font-size: 14px;
  line-height: 1.45;
}

.sf-option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sf-option-label {
  font-size: 13px;
  font-weight: 700;
}

.sf-option-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sf-option-chip {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--sf-border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--sf-muted);
  cursor: pointer;
}

.sf-option-chip.is-active {
  border-color: var(--sf-primary);
  background: var(--sf-primary-soft);
  color: var(--sf-primary);
}

.sf-option-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sf-sheet-qty {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  padding: 4px;
  border: 1px solid var(--sf-border);
  border-radius: 999px;
}

.sf-sheet-qty button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: #f5f5f4;
  font-size: 18px;
  cursor: pointer;
}

.sf-sheet-qty span {
  min-width: 20px;
  text-align: center;
  font-weight: 700;
}

.sf-primary-btn,
.sf-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.sf-primary-btn {
  background: var(--sf-primary);
  color: #fff;
}

.sf-primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sf-secondary-btn {
  background: #f5f5f4;
  color: var(--sf-text);
}

.sf-cart-panel {
  padding-bottom: calc(12px + var(--sf-safe-bottom));
}

.sf-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.sf-cart-head h2 {
  margin: 0;
  font-size: 18px;
}

.sf-cart-head .sf-sheet-close {
  position: static;
}

.sf-cart-body {
  padding: 0 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 40vh;
  overflow: auto;
}

.sf-cart-empty {
  color: var(--sf-muted);
  font-size: 14px;
  padding: 12px 0;
}

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

.sf-cart-line-name {
  font-size: 14px;
  font-weight: 650;
}

.sf-cart-line-meta {
  font-size: 12px;
  color: var(--sf-muted);
}

.sf-cart-line-price {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

.sf-cart-line-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sf-cart-line-actions button {
  height: 28px;
  min-width: 28px;
  border: 1px solid var(--sf-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}

.sf-checkout {
  padding: 8px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--sf-border);
}

.sf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.sf-field input,
.sf-field textarea {
  width: 100%;
  border: 1px solid var(--sf-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  background: #fff;
}

.sf-field input:focus,
.sf-field textarea:focus {
  outline: none;
  border-color: var(--sf-primary);
  box-shadow: 0 0 0 3px var(--sf-primary-soft);
}

.sf-checkout-error {
  margin: 0;
  color: var(--sf-danger);
  font-size: 13px;
}

.sf-success-panel {
  padding: 28px 20px calc(24px + var(--sf-safe-bottom));
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.sf-success-icon {
  font-size: 48px;
  color: #16a34a;
}

.sf-success-panel h2 {
  margin: 0;
  font-size: 22px;
}

.sf-success-panel p {
  margin: 0;
  color: var(--sf-muted);
  font-size: 14px;
}
