/* Cách mua: tab, bộ lọc, lưới, hộp xác nhận, thanh giỏ. Mobile-first. */
.tgg-modes { --m-green: #14532d; --m-red: #e5391d; --m-cream: #fff8ee; --m-line: #eadfcb; margin: 14px 0 90px; }
.tgg-mhead { text-align: center; margin: 4px 0 8px; }
.tgg-mhead h2 { font-size: clamp(13px, 4.3vw, 20px); line-height: 1.25; margin: 0 0 2px; color: var(--m-green); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* Luôn 1 dòng: chữ tự co theo bề ngang màn hình. */

.tgg-modebar { position: sticky; top: var(--tgg-header-h, 56px); z-index: 25; background: var(--m-cream); padding: 6px 0 4px; }
.tgg-modes .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tgg-modes .tab { border: 1.5px solid var(--m-line); background: #fff; border-radius: 12px; padding: 10px 2px; font-weight: 800; font-size: 12.5px; color: #3a2b1d; cursor: pointer; min-height: 42px; }
.tgg-modes .tab .ck { display: none; margin-right: 3px; }
.tgg-modes .tab.on { background: var(--m-green); color: #fff; border-color: var(--m-green); }
.tgg-modes .tab.on .ck { display: inline; }
.tgg-modes .tab.off { opacity: .45; }
.tgg-modes .note { margin: 6px 0 4px; padding: 7px 10px; font-size: 13.5px; font-weight: 800; color: #d32f2f; background: #fff1d6; border: 1px solid #f3c77a; border-left: 4px solid #d32f2f; border-radius: 10px; line-height: 1.35; }
.tgg-modes .note .how { color: #1565c0; font-weight: 800; margin-left: 4px; white-space: nowrap; text-decoration: underline; }
/* Dòng mô tả cách mua luôn 1 dòng (chữ tự co theo màn hình); link "Khu vực có nhóm" của Mua chung xuống dòng riêng. */
.tgg-modes .note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(11px, 3.5vw, 13.5px); }
.tgg-modes .note .how { display: block; margin: 3px 0 0; }
.tgg-modes .note .how[hidden] { display: none; }
.tgg-modes .chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tgg-modes .chips::-webkit-scrollbar { display: none; }
.tgg-modes .pill { flex: 0 0 auto; border: 1px solid var(--m-line); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tgg-modes .pill.on { background: var(--m-red); border-color: var(--m-red); color: #fff; }

.tgg-mgrid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .tgg-mgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .tgg-mgrid { grid-template-columns: repeat(4, 1fr); } }
.tgg-mcard { display: flex; gap: 10px; background: #fff; border: 1px solid var(--m-line); border-radius: 14px; padding: 8px; position: relative; }
.tgg-mcard[hidden] { display: none; }
.tgg-mcard .img { flex: 0 0 96px; position: relative; display: block; }
.tgg-mcard .img img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; display: block; }
.tgg-mcard .tgg-badge { position: static; inset: auto; transform: none; display: block; width: 100%; box-sizing: border-box; margin-top: 4px; background: var(--m-red); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 6px; border-radius: 6px; text-align: center; line-height: 1.2; }
.tgg-mcard .b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tgg-mcard h3 { margin: 0; font-size: 14.5px; line-height: 1.25; }
.tgg-mcard h3 a { color: inherit; text-decoration: none; }
.tgg-mcard .serves { font-size: 12px; color: var(--m-green); font-weight: 700; }
.tgg-mcard .short { font-size: 12px; color: #6a5a4a; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tgg-mcard .flv { font-size: 12px; display: flex; gap: 4px; align-items: center; }
.tgg-mcard .flv select { font-size: 12px; padding: 2px 4px; border-radius: 6px; max-width: 150px; }
.tgg-mcard .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: auto; }
.tgg-mcard .pricebox { display: flex; flex-direction: column; font-size: 12px; }
.tgg-mcard .pricebox .old { color: #9a8a7a; font-size: 12.5px; }
.tgg-mcard .pricebox .now { font-size: 16px; color: var(--m-red); font-weight: 800; }
.tgg-mcard .pricebox .save { font-size: 11.5px; color: var(--m-green); font-weight: 700; }
.tgg-mcard .pricebox .hint { font-size: 11.5px; color: #1565c0; font-weight: 800; }
.tgg-mcard .plus { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--m-red); color: #fff; font-size: 22px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.tgg-mcard .step { display: inline-flex; align-items: center; background: #fff3ee; border: 1px solid var(--m-red); border-radius: 999px; }
.tgg-mcard .step button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--m-red); font-size: 20px; font-weight: 800; cursor: pointer; }
.tgg-mcard .step b { min-width: 20px; text-align: center; }
.tgg-modes .tgg-empty { text-align: center; color: #7a6a5a; padding: 20px 0; }

.tgg-cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--m-cream); box-shadow: 0 -2px 10px rgba(0,0,0,.12); }
.tgg-cartbar[hidden] { display: none; }
.tgg-cartbar a { display: flex; justify-content: center; gap: 4px; background: var(--m-green); color: #fff; text-decoration: none; padding: 12px; border-radius: 12px; font-weight: 700; }
@media (min-width: 900px) { .tgg-cartbar { display: none !important; } }


.tgg-mmodal { position: fixed; inset: 0; z-index: 100; background: rgba(30,20,10,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tgg-mmodal .box { background: #fff; border-radius: 16px; max-width: 420px; width: 100%; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.tgg-mmodal h3 { margin: 0 0 8px; font-size: 17px; color: var(--m-green, #14532d); }
.tgg-mmodal .pr { font-weight: 800; font-size: 15px; margin: 6px 0; }
.tgg-mmodal .nt { color: #5b4a3b; font-size: 13.5px; margin: 6px 0; }
.tgg-mmodal .steps { padding-left: 20px; font-size: 14px; line-height: 1.5; }
.tgg-mmodal .btns { display: flex; gap: 8px; margin-top: 14px; }
.tgg-mmodal .btns button, .tgg-mmodal .choose button { flex: 1; min-height: 44px; border-radius: 12px; font-weight: 800; font-size: 14px; cursor: pointer; border: 1.5px solid #14532d; }
.tgg-mmodal .btn-c { background: #fff; color: #14532d; }
.tgg-mmodal .btn-y { background: #14532d; color: #fff; }
.tgg-mmodal .choose { display: grid; gap: 8px; }
.tgg-mmodal .choose button { background: #fff; color: #14532d; }
.tgg-mmodal .choose button:disabled { opacity: .4; }

.tgg-mtoast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 110; background: #2b2118; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; transition: opacity .2s, transform .2s; max-width: calc(100% - 24px); }
.tgg-mtoast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.tgg-mtoast.err { background: #b71c1c; }
.tgg-mtoast button { background: #ffd24a; color: #2b2118; border: 0; border-radius: 8px; padding: 4px 10px; font-weight: 800; cursor: pointer; }

.tgg-cartmode { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff8ee; border: 1px solid #eadfcb; border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; font-size: 14px; }
.tgg-cartmode .chg { border: 1.5px solid #14532d; background: #fff; color: #14532d; border-radius: 999px; padding: 4px 12px; font-weight: 800; cursor: pointer; }
.tgg-cartmode .sv { flex-basis: 100%; color: #14532d; font-size: 13px; }


/* Popup Cách hoạt động: 3 ý chính + hỏi đáp (cuộn được). */
.tgg-mmodal .box { max-height: 90vh; overflow-y: auto; }
.tgg-mmodal .faqh { margin: 14px 0 6px; font-size: 15px; color: #14532d; }
.tgg-mmodal .faq details { border: 1px solid #eadfcb; border-radius: 10px; padding: 8px 10px; margin: 0 0 6px; background: #fffdf8; }
.tgg-mmodal .faq summary { font-weight: 700; font-size: 13.5px; cursor: pointer; }
.tgg-mmodal .faq p { margin: 6px 0 2px; font-size: 13px; line-height: 1.45; color: #4a3b2d; }
.tgg-mmodal .faqz { font-size: 13px; margin: 8px 0 0; }
.tgg-mmodal .faqz a { color: #1565c0; font-weight: 800; }
.tgg-mmodal .faqall { margin: 10px 0 0; }
.tgg-mmodal .faqall > summary { cursor: pointer; font-weight: 800; font-size: 14.5px; color: #1565c0; padding: 8px 0; }
.tgg-mmodal .faqall[open] > summary { margin-bottom: 4px; }
.tgg-mmodal .mc-buy { margin: 12px 0 4px; }

/* Món hết hàng ở mọi cửa hàng: mờ đi, nhãn đỏ, không thêm được. */
.tgg-mcard.is-out .img img, .tgg-mcard.is-out h3, .tgg-mcard.is-out .pricebox { opacity: .55; }
.tgg-mcard .tgg-badge.soldout { background: #6b6b6b; }
.tgg-mcard .plus.out { width: auto; padding: 0 12px; border-radius: 999px; background: #9e9e9e; font-size: 12px; font-weight: 800; cursor: default; }

/* Tab Đặt trước (ghé lấy): dòng phụ nhỏ bên dưới tên tab. */
.tgg-modes .tab small { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.1; text-transform: none; }
