/* ==========================================================================
   1995 Food & Beer — nâng cấp trải nghiệm (v24), đi cùng app-ux-v24.js
   Bo góc 12px; vùng chạm ≥ 38px; chữ Inter.
   ========================================================================== */

/* 1. Bỏ khung cuộn lồng trong nội dung chính: cả trang cuộn tự nhiên như app.
   Giữ khung nhỏ (max-h-24/32/48: ghi chú, gợi ý) và khung h-full (nằm trong ô cao cố định). */
html.m22 .app-main :is(.max-h-56, .max-h-60, .max-h-80, .max-h-96, .max-h-\[290px\], .max-h-\[500px\]).overflow-y-auto:not(.h-full) {
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}

/* Tiêu đề nhóm dính (vd "Hải sản 24") giờ dính theo trang → nằm ngay dưới thanh đầu trang. */
html.m22 .app-main :is(.max-h-56, .max-h-60, .max-h-80, .max-h-96, .max-h-\[290px\], .max-h-\[500px\]).overflow-y-auto:not(.h-full) .sticky.top-0 {
  top: calc(var(--m22-header-h) + var(--m22-sat)) !important;
}

/* Chừa chỗ cuối trang khi thanh giỏ đang hiện. */
html.m22.ux24-cartbar-on body.has-app-nav .app-main {
  padding-bottom: calc(var(--m22-tabbar-h) + var(--m22-sab) + 96px) !important;
}

html.m22 .ux24-filtered,
html.m22 .ux24-hidden,
html.m22 .ux24-quiet-ok {
  display: none !important;
}

/* 2. Đăng nhập: nút hiện/ẩn mật khẩu */
html.m22 .ux24-pass-wrap { position: relative; }
html.m22 .ux24-pass-wrap input[data-ux24-pass] { padding-right: 52px !important; }

html.m22 .ux24-pass-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--m22-muted) !important;
  box-shadow: none !important;
  transform: translateY(-50%);
  cursor: pointer;
}

html.m22 .ux24-pass-toggle svg { width: 20px; height: 20px; }
html.m22 .ux24-pass-toggle:active { background: var(--m22-fill) !important; }

/* 3. Thanh giỏ dính đáy (Đề xuất, Phiếu chi) */
html.m22 .ux24-cartbar {
  position: fixed;
  z-index: 55;
  left: 50%;
  bottom: calc(var(--m22-tabbar-h) + var(--m22-sab) + 10px);
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(var(--m22-frame-w, 430px) - 24px), calc(100vw - 24px));
  min-height: 58px;
  padding: 8px 8px 8px 12px;
  border-radius: 12px;
  background: var(--m22-navy);
  color: #ffffff;
  font-family: "Inter", Arial, sans-serif;
  box-shadow: 0 14px 34px rgba(4, 12, 24, 0.32);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms var(--m22-ease, ease);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

html.m22 .ux24-cartbar.is-show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
html.m22 .ux24-cartbar:focus-visible { outline: 3px solid var(--m22-amber); outline-offset: 2px; }

html.m22 .ux24-cartbar__icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
}

html.m22 .ux24-cartbar__icon svg { width: 20px; height: 20px; }
html.m22 .ux24-cartbar__text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; line-height: 1.25; }
html.m22 .ux24-cartbar__text b { font-size: 15px; font-weight: 800; }
html.m22 .ux24-cartbar__text span { color: rgba(255, 255, 255, 0.78); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

html.m22 .ux24-cartbar__btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  min-height: 42px;
  padding: 0 10px 0 14px;
  border-radius: 12px;
  background: var(--m22-amber);
  color: #0b1a30;
  font-size: 14.5px;
  font-weight: 800;
  white-space: nowrap;
}

html.m22 .ux24-cartbar__btn svg { width: 18px; height: 18px; }

html.m22 .ux24-flash { animation: ux24-flash 1.2s ease; border-radius: 12px; }

@keyframes ux24-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 181, 44, 0); }
  30% { box-shadow: 0 0 0 4px rgba(244, 181, 44, 0.75); }
}

/* 4. Bếp: ô đầu Trang chủ là việc của Bếp (nội dung lấy từ thuộc tính data-ux24-*) */
html.m22 .app-main .app-kpi-card.ux24-kpi { cursor: pointer; justify-content: flex-start !important; }
html.m22 .app-main .app-kpi-card.ux24-kpi > * { display: none !important; }

/* app-mobile-v22.css dùng ::before của ô KPI làm vạch trang trí (absolute, cao 3,5px) → ghi đè hẳn. */
html.m22 .app-main .app-kpi-card.ux24-kpi::before {
  content: attr(data-ux24-label) !important;
  position: static !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  background: none !important;
  color: var(--m22-muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

html.m22 .app-main .app-kpi-card.ux24-kpi::after {
  content: attr(data-ux24-value) !important;
  position: static !important;
  display: block !important;
  margin-top: 10px;
  color: var(--m22-ink);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html.m22 .app-main .app-kpi-card.ux24-kpi:first-child::before { color: rgba(11, 26, 48, 0.72); }
html.m22 .app-main .app-kpi-card.ux24-kpi:first-child::after { color: #0b1a30; }
html.m22 .app-main .app-kpi-card.ux24-kpi:active { transform: scale(0.98); }

/* 5. Bếp: nhắc kiểm kê */
html.m22 .ux24-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 12px 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--m22-text);
  box-shadow: var(--m22-shadow-card);
}

/* Nằm trong thẻ (Trang chủ Bếp, chỗ banner kho): nền nhạt, không đổ bóng. */
html.m22 .app-main .rounded-2xl .ux24-hint { margin: 0; background: #fff8eb; box-shadow: inset 0 0 0 1px #f6dfb4; }

html.m22 .ux24-hint__icon {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fdf1dc;
  color: #a14a06;
}

html.m22 .ux24-hint__icon svg { width: 20px; height: 20px; }
html.m22 .ux24-hint__text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
html.m22 .ux24-hint__text b { color: var(--m22-ink); font-size: 15px; font-weight: 800; }
html.m22 .ux24-hint__text span { color: var(--m22-muted); font-size: 13px; line-height: 1.35; }

html.m22 .ux24-hint__btn {
  flex: 0 0 auto;
  min-height: 40px !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--m22-navy) !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  white-space: nowrap;
}

/* 6. Hàng chip lọc (Duyệt đơn, Nhật ký) */
html.m22 .ux24-chips {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  overflow-x: auto;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--m22-shadow-card);
  scrollbar-width: none;
}

html.m22 .ux24-chips::-webkit-scrollbar { display: none; }

html.m22 .ux24-chips.is-sticky {
  position: sticky;
  top: calc(var(--m22-header-h) + var(--m22-sat) + 8px);
  z-index: 20;
}

/* Chip nằm trong thẻ (Nhật ký): nền nhạt, không đổ bóng. */
html.m22 .app-main .rounded-2xl .ux24-chips { gap: 4px; background: var(--m22-fill); box-shadow: none; margin-bottom: 12px; }
/* Trong thẻ hẹp hơn (~300px): chip nhỏ lại để 3 chip vừa một hàng. */
html.m22 .app-main .rounded-2xl .ux24-chips button { flex: 1 1 auto; justify-content: center; padding: 0 8px !important; font-size: 13.5px !important; }

html.m22 .ux24-chips button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 38px !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--m22-muted) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  white-space: nowrap;
  box-shadow: none !important;
}

html.m22 .ux24-chips button[aria-pressed="true"] { background: var(--m22-navy) !important; color: #ffffff !important; }

html.m22 .ux24-chips__n {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--m22-fill-strong);
  color: var(--m22-ink);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

html.m22 .ux24-chips button[aria-pressed="true"] .ux24-chips__n { background: rgba(255, 255, 255, 0.2); color: #ffffff; }

html.m22 .ux24-more {
  display: block;
  width: 100%;
  min-height: 46px !important;
  margin-top: 12px;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--m22-fill-strong) !important;
  color: var(--m22-ink) !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
}

html.m22 .ux24-more[hidden] { display: none !important; }

/* Ghim / yêu thích ở danh sách nguyên liệu: biểu tượng chỉ 8px và tô đặc xám (trông như đang bật).
   To 16px; chưa bật thì chỉ vẽ viền, đã bật giữ tô đặc màu của bundle. */
html.m22 .app-main button:has(> svg.lucide-pin),
html.m22 .app-main button:has(> svg.lucide-star) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  /* Quy tắc nút chung đặt padding 4px 12px → nút 32px chỉ còn 8px cho biểu tượng. */
  padding: 0 !important;
  border-radius: 12px !important;
}

html.m22 .app-main button > svg.lucide-pin,
html.m22 .app-main button > svg.lucide-star { flex: 0 0 16px; width: 16px !important; height: 16px !important; }

html.m22 .app-main button[title="Ghim mặt hàng lên đầu"],
html.m22 .app-main button[title="Thêm vào danh sách yêu thích"] { color: #8b95a7 !important; }

html.m22 .app-main button[title="Ghim mặt hàng lên đầu"] > svg,
html.m22 .app-main button[title="Thêm vào danh sách yêu thích"] > svg { fill: none !important; }

/* 7. Quản lý: Bàn làm việc */
html.m22 .ux24-tasks .ux24-tasks__head { flex-wrap: wrap !important; row-gap: 10px !important; }
html.m22 .ux24-tasks .ux24-tasks__head h3 { white-space: nowrap; }

html.m22 .ux24-tasks .cursor-pointer.ux24-task-done {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0.78;
}

html.m22 .ux24-tasks .cursor-pointer.ux24-task-done p + p { display: none !important; }
