:root {
  --brand: #d97706;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, #ffffff);
  --brand-dark: color-mix(in srgb, var(--brand) 82%, #000000);
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --border-strong: #64748b;
  --danger: #d93025;
  --danger-bg: #fce8e6;
  --success: #15803d;
  --radius: 16px;
  --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-block-end: 6.5rem;
}

/* Utility ẩn trực quan nhưng giữ nguyên cho trình đọc màn hình */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Focus chuẩn trợ năng */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.container {
  max-width: 980px;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Top Demo Bar (Giúp đổi ngành/tạo link chào khách nhanh) */
.demo-switcher {
  background: #0f172a;
  color: #f8fafc;
  padding-block: 0.55rem;
  font-size: 0.85rem;
}

.demo-switcher-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.niche-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.pill-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  min-height: 36px;
  cursor: pointer;
}

.pill-btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.studio-trigger-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  background: #10b981;
  color: #022c22;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
}

/* Header thương hiệu của quán */
.brand-header {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  color: #ffffff;
  padding-block: 1.5rem 1.75rem;
  border-end-start-radius: 24px;
  border-end-end-radius: 24px;
  box-shadow: var(--shadow);
}

.brand-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.niche-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-block-end: 0.5rem;
}

.brand-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.2;
}

.brand-tagline {
  margin: 0 0 0.85rem;
  opacity: 0.95;
  font-size: 0.96rem;
}

.brand-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.88rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-outline-light {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  min-height: 48px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

/* Search & Category Filter */
.menu-controls {
  margin-block: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.search-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-block-end: 0.85rem;
}

.search-row label {
  font-weight: 600;
  font-size: 0.9rem;
}

.search-input {
  font: inherit;
  font-size: max(1rem, 1em);
  min-height: 48px;
  padding: 0.7rem 0.95rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  width: 100%;
  background: #ffffff;
  color: var(--text);
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-block-end: 0.25rem;
}

.cat-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.cat-btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

/* Menu Grid */
.section-heading {
  font-size: 1.2rem;
  margin: 1.25rem 0 0.85rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 1rem;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  box-shadow: var(--shadow);
}

.item-top {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.item-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  font-size: 1.75rem;
}

.item-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1.03rem;
}

.item-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-block-end: 0.3rem;
}

.item-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block-start: 0.65rem;
  border-block-start: 1px dashed var(--border);
}

.item-price {
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--brand-dark);
}

.add-btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 48px;
  padding: 0.55rem 1.05rem;
  border-radius: 12px;
  border: 0;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.step-btn {
  font: inherit;
  font-weight: 800;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  cursor: pointer;
}

.step-count {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
}

/* Sticky Bottom Cart Bar */
.sticky-cart {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-block-start: 1px solid var(--border);
  padding: 0.75rem 1rem;
  box-shadow: 0 -8px 25px rgba(15, 23, 42, 0.12);
}

.sticky-cart-inner {
  max-width: 980px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cart-summary-text strong {
  display: block;
  font-size: 1.05rem;
  color: var(--brand-dark);
}

.cart-summary-text span {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-primary {
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  border-radius: 12px;
  border: 0;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
}

.btn-secondary {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 48px;
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Native Modal Dialogs & Scroll Containment (Modern Web Guidance compliant) */
dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  width: min(94vw, 560px);
  max-height: 90dvh;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-block-end: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.18rem;
}

.close-icon-btn {
  font: inherit;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.dialog-body {
  padding: 1.25rem;
}

/* Forms & Deferred Validation (:user-invalid) */
.field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  margin-block-end: 1.15rem;
}

.field label,
fieldset legend {
  font-weight: 600;
  font-size: 0.92rem;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: max(1rem, 1em);
  padding: 0.75rem 0.9rem;
  min-height: 48px;
  border: 1.5px solid #767676;
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
}

@media (pointer: coarse) {
  .field input,
  .field select,
  .field textarea {
    min-height: 52px;
  }
}

fieldset.radio-group {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0 0 1.15rem;
}

.radio-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.15rem;
  margin-block-start: 0.4rem;
}

.radio-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
}

.radio-item input[type="radio"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand);
  margin: 0;
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
  margin-block-start: 0.2rem;
}

.field :is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger);
  background-color: var(--danger-bg);
}

.field :is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: block;
}

.field :is(:user-valid, .user-valid-fallback) {
  border-color: var(--success);
}

/* Cart Lines inside Modal */
.cart-lines {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-block-end: 1px solid var(--border);
}

.cart-line:last-child {
  border-block-end: 0;
}

/* VietQR & Standee Print Cards */
.qr-card {
  text-align: center;
  border: 2px dashed var(--brand);
  border-radius: 16px;
  padding: 1.25rem;
  background: #ffffff;
  margin-block-end: 1rem;
}

.qr-card img {
  display: block;
  margin: 0.75rem auto;
  max-width: 240px;
  height: auto;
  border-radius: 12px;
}

.pitch-box {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin-block: 0.75rem;
}

.site-footer {
  margin-block-start: 2.5rem;
  padding-block: 1.5rem;
  border-block-start: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

@media print {
  body * {
    visibility: hidden;
  }
  #standeePrintArea,
  #standeePrintArea * {
    visibility: visible;
  }
  #standeePrintArea {
    position: fixed;
    inset: 1.5cm;
    border: 3px solid #0f172a;
    padding: 2rem;
  }
}
