.v4-mb-wrap {
  padding-bottom: 30px;
}

.v4-mb-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #212121;
  margin: 18px 0 10px;
}

.v4-mb-divider {
  position: relative;
  /* JW 2026/01/31 排版修正：與麵包屑左側黑色格子切齊（不要置中縮排） */
  margin: 0 0 22px;
  max-width: none;
}
.v4-mb-divider:before {
  content: "";
  display: block;
  border-top: 1px solid #d9d9d9;
}
.v4-mb-divider-bar {
  position: absolute;
  left: 50%;
  top: -1px;
  transform: translateX(-50%);
  width: 150px;
  height: 6px;
  display: grid;
  grid-template-columns: 1fr 2fr;
}
.v4-mb-divider-bar .bar-red {
  background: #d0343d;
}
.v4-mb-divider-bar .bar-black {
  background: #212121;
}

.v4-mb-tabs {
  /* JW 2026/01/31 排版修正：與麵包屑左側黑色格子切齊（不要置中縮排） */
  max-width: none;
  margin: 0 0 22px;
  padding-bottom: 0;
  border-bottom: 1px solid #d9d9d9;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}
.v4-mb-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #212121;
  text-decoration: none;
  font-size: 14px;
  padding: 0 2px 10px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px; /* overlay tabs underline on container bottom line */
}
.tab-menu-swiper02 .swiper-slide a.v4-mb-tab {
  padding-bottom: 10px;
}
.v4-mb-tab + .v4-mb-tab:before {
  content: "";
  position: absolute;
  left: 0px;
  top: 4px;
  width: 1px;
  height: 16px;
  background: #bdbdbd;
}
.v4-mb-tab .sep {
  color: #bdbdbd;
  margin-left: 10px;
}
.v4-mb-tab.is-active {
  font-weight: 800;
  border-bottom-color: #212121;
}
.v4-mb-tab.is-active:after {
  content: "";
  width: 18px;
  height: 18px;
  background: url("../../img/v4/member_selected.png") no-repeat center/contain;
  display: inline-block;
  transform: translateY(1px);
}

.v4-mb-section {
  /* JW 2026/01/31 排版修正：與麵包屑左側黑色格子切齊（不要置中縮排） */
  max-width: none;
  margin: 0 0 18px;
  display: none;
}
.v4-mb-section.is-active {
  display: block;
}

/* Card status */
.v4-mb-card-area {
  text-align: center;
  margin: 10px 0 12px;
}
.v4-mb-card-area img {
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: 12px;
/*  border: 2px solid #2b7cff;*/
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.v4-mb-consume-line {
  text-align: center;
  font-size: 14px;
  color: #212121;
  line-height: 1.9;
  margin: 10px 0 0;
}
.v4-mb-consume-line .red {
  color: #d0343d;
  font-weight: 800;
}
.v4-mb-consume-note {
  text-align: center;
  color: #9a9a9a;
  font-size: 12px;
  margin-top: 4px;
}

/* Query cards */
.v4-mb-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 0 0 14px;
}
.v4-mb-metric {
  background: #f2f2f2;
  border-radius: 12px;
  padding: 22px 22px;
  min-height: 120px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.v4-mb-metric-title {
  font-size: 18px;
  font-weight: 800;
  color: #212121;
  margin-bottom: 10px;
}
.v4-mb-metric-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d0343d;
  font-weight: 800;
}
.v4-mb-metric-icon {
  width: 22px;
  height: 22px;
  display: block;
}
.v4-mb-metric-brand .p {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d0343d;
  color: #fff;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.v4-mb-metric-value {
  font-size: 36px;
  font-weight: 900;
  color: #d0343d;
}
.v4-mb-metric-unit {
  color: #9a9a9a;
  font-size: 12px;
  font-weight: 700;
  margin-left: 2px;
}
.v4-mb-metric-sub {
  grid-column: 1 / -1;
  text-align: right;
  color: #9a9a9a;
  font-size: 12px;
  margin-top: 6px;
}

.v4-mb-query-box {
  background: #f2f2f2;
  border-radius: 12px;
  padding: 18px;
  margin: 0 0 18px;
}
.v4-mb-query-grid {
  display: grid;
  grid-template-columns: 110px 1fr 110px 1fr;
  gap: 12px 14px;
  align-items: center;
}
.v4-mb-query-grid--stack {
  /* JW 2026/01/30 依新版 V4 WWW 查詢區塊設計：店別/交易日期垂直排列，label 左側切齊 */
  grid-template-columns: 110px 1fr;
}
.v4-mb-label {
  color: #747474;
  font-size: 13px;
  font-weight: 700;
}
.v4-mb-label .hint {
  display: block;
  color: #9a9a9a;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.v4-mb-select,
.v4-mb-date {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  background: #fff;
  padding: 0 12px;
  font-size: 13px;
  /* Safari：在 flex/grid 容器內避免被內容尺寸撐爆 */
  min-width: 0;
}
.v4-mb-date {
  /* JW 2026/01/15 設計圖：開始/結束時間左側有小 icon */
  background-image: url("../../img/v4/calendar_month.png");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 16px 16px;
  padding-left: 38px;
}
.v4-mb-date-wrap {
  display: grid;
  /* Safari：grid 在 flex item 內時，1fr 的 min-size 可能導致超寬；改用 minmax(0,1fr) 允許縮 */
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.v4-mb-date-mid {
  text-align: center;
  color: #9a9a9a;
}
.v4-mb-date-range {
  display: flex;
  /* JW 2026/01/31 RWD：桌機維持「單一橫列」不要自動換行（避免介於桌機/手機之間出現尷尬兩行） */
  flex-wrap: nowrap;
  gap: 12px 18px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.v4-mb-date-radios {
  display: flex;
  /* JW 2026/01/31 RWD：桌機維持「單一橫列」不要自動換行 */
  flex-wrap: nowrap;
  gap: 12px 18px;
  align-items: center;
  flex: 0 0 auto;
}
.v4-mb-date-other {
  display: flex;
  /* Safari/Chromium 行為差：flex item 內含 grid 時，沒設 min-width:0 容易被撐爆而換行 */
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  gap: 10px;
  align-items: center;
}
.v4-mb-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #747474;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.v4-mb-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #cfcfcf;
  border-radius: 50%;
  background: #fff;
  position: relative;
  margin: 0;
  flex: 0 0 auto;
}
.v4-mb-radio input[type="radio"]:checked {
  border-color: #d0343d;
}
.v4-mb-radio input[type="radio"]:checked:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #d0343d;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.v4-mb-date-wrap.is-disabled input.v4-mb-date,
.v4-mb-date input.v4-mb-date:disabled,
input.v4-mb-date:disabled {
  background: #f2f2f2;
  color: #9a9a9a;
  cursor: not-allowed;
}
.v4-mb-query-hint {
  color: #9a9a9a;
  font-size: 12px;
  margin-top: -6px;
}
.v4-mb-search-btn {
  margin-top: 14px;
  width: 100%;
  border: 0;
  background: #d0343d;
  color: #fff;
  border-radius: 999px;
  height: 52px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.v4-mb-search-btn:disabled,
.v4-mb-search-btn.is-busy {
  background: #cfcfcf;
  opacity: 0.85;
  cursor: not-allowed;
}
.v4-mb-search-btn:disabled .arrow,
.v4-mb-search-btn.is-busy .arrow {
  opacity: 0.95;
}
.v4-mb-search-btn .arrow {
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 767px) {
  /* 手機：交易日期 (限12個月內) 不換行，維持同一行並保留小間距 */
  .v4-mb-label .hint {
    display: inline;
    margin-top: 0;
    margin-left: 6px;
  }

  /* 手機版查詢區塊：label 在上、欄位在下（符合設計稿/截圖） */
  /* 注意：<=767 同時也符合 <=991，且 <=991 的 .v4-mb-query-grid 規則在檔案後段會覆蓋；
     這邊用更高 specificity 確保手機版 stack 永遠是單欄 */
  .v4-mb-query-grid.v4-mb-query-grid--stack {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .v4-mb-date-range {
    flex-direction: column;
    align-items: flex-start;
    overflow-x: visible;
  }
  .v4-mb-date-radios {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .v4-mb-date-other {
    width: 100%;
    /* 需求：其他 + 開始/結束時間 + ~ 維持同一行 */
    flex-wrap: nowrap;
  }
  /* 同上：避免被 <=991 的 .v4-mb-date-wrap { grid-template-columns: 1fr; } 蓋掉 */
  .v4-mb-date-other .v4-mb-date-wrap {
    width: 100%;
    /* 覆蓋 <=991px 的單欄設定，手機也要維持同一行含 ~ */
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  }
  .v4-mb-date-wrap .v4-mb-date-mid {
    display: block;
  }
}

/* Tables */
.v4-mb-table-wrap {
  margin-top: 6px;
  border-top: 1px solid #d9d9d9;
}
.v4-mb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.v4-mb-table thead th {
  background: #f2f2f2;
  color: #747474;
  padding: 12px 10px;
  border-top: 2px solid #cfcfcf;
  border-bottom: 2px solid #cfcfcf;
  font-weight: 800;
  text-align: center;
}
.v4-mb-table td {
/*  padding: 14px 10px;*/
  border-bottom: 1px solid #e6e6e6;
  vertical-align: middle;
  text-align: center;
}
.v4-mb-table td.left {
  text-align: left;
}

/* 三欄均分（點數/電子商品禮券/電子抵用金） */
.v4-mb-table-3col col {
  width: 33.3333%;
}
.v4-mb-table-3col td:nth-child(2),
.v4-mb-table-3col th:nth-child(2) {
  text-align: center;
}

/* 電子贈品禮券：前三欄均分，最後一欄固定放 + */
.v4-mb-table-gift col.c1,
.v4-mb-table-gift col.c2,
.v4-mb-table-gift col.c3 {
  width: 33.3333%;
}
.v4-mb-table-gift col.c4 {
  width: 60px;
}

/* jQuery UI datepicker：避免被全域 table 樣式撐爆 */
.ui-datepicker {
  width: auto !important;
  max-width: 260px;
  box-sizing: border-box;
  z-index: 9999 !important;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  /* JW 2026/01/15 避免被全域字級/縮放撐爆（Safari 特別明顯） */
  font-size: 12px !important;
  transform: none !important;
  padding: 10px 10px 12px;
}
.ui-datepicker table {
  width: 100% !important;
  max-width: 100%;
  table-layout: fixed !important;
  font-size: 12px !important;
  margin: 0 !important;
}
.ui-datepicker .ui-datepicker-header {
  padding: 6px 0;
  background: #fff;
  border: 0;
}
.ui-datepicker .ui-datepicker-title {
  font-size: 13px !important;
  font-weight: 800;
  line-height: 26px;
}
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #e6e6e6;
  background: #fff;
}
.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
  border-color: #d0d0d0;
  background: #f7f7f7;
}
.ui-datepicker .ui-datepicker-prev span,
.ui-datepicker .ui-datepicker-next span {
  display: none; /* 有些站台 ui-icon sprite 會被吃掉，直接用文字箭頭 */
}
.ui-datepicker .ui-datepicker-prev:before,
.ui-datepicker .ui-datepicker-next:before {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  line-height: 1;
  color: #212121;
  font-weight: 900;
}
.ui-datepicker .ui-datepicker-prev:before {
  content: "‹";
}
.ui-datepicker .ui-datepicker-next:before {
  content: "›";
}
.ui-datepicker td span,
.ui-datepicker td a {
  padding: 0 !important;
  width: 30px;
  height: 30px;
  line-height: 30px;
  display: inline-block;
  text-align: center;
}
.ui-datepicker td {
  padding: 0 !important;
}
.ui-datepicker th {
  padding: 0 !important;
  height: 28px;
  font-size: 12px !important;
  color: #747474;
}
.ui-datepicker .ui-state-default {
  border: 0;
  background: transparent;
  color: #212121;
  border-radius: 8px;
  font-size: 12px !important;
}
.ui-datepicker .ui-state-hover {
  background: #f2f2f2;
}
.ui-datepicker .ui-state-active {
  background: #d0343d;
  color: #fff;
}

/* 強制覆蓋：有些站台會對 table/td/a 設很大字（造成你截圖那種爆大） */
.ui-datepicker,
.ui-datepicker * {
  font-size: 12px !important;
}
.ui-datepicker .ui-datepicker-title * {
  font-size: 13px !important;
}
.v4-mb-red {
  color: #d0343d;
  font-weight: 800;
}
.v4-mb-muted {
  color: #9a9a9a;
}

/* ==================== Search status (loading / empty) ==================== */
/* //JW 2026/01/24 需求：搜尋中顯示轉圈圈；若查無資料顯示紅字「目前無任何資料！」 */
.v4-mb-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 0;
  width: 100%;
  font-size: 15px;
  font-weight: 900;
}
.v4-mb-status--empty {
  color: #d0343d;
}
.v4-mb-status--loading {
  color: #747474;
  font-weight: 800;
}
.v4-mb-status-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e0e0e0;
  border-top: 2px solid #d0343d;
  border-radius: 50%;
  animation: v4-mb-spin 0.9s linear infinite;
}
@keyframes v4-mb-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.v4-mb-plus-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #efefef;
  border: 0;
  color: #9a9a9a;
  font-weight: 900;
  line-height: 26px;
}
.v4-mb-expand-row td {
  background: #f7f7f7;
  padding: 10px;
  border-bottom: 1px solid #e6e6e6;
}
.v4-mb-expand-title {
  font-weight: 800;
  color: #747474;
  text-align: center;
  padding: 6px 0 10px;
}
.v4-mb-expand-item {
  display: grid;
  grid-template-columns: 160px 1fr 90px;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #e6e6e6;
  align-items: center;
  font-size: 13px;
}
.v4-mb-expand-item:first-child {
  border-top: 0;
}
.v4-mb-expand-item .amt {
  text-align: right;
  font-weight: 800;
}
.v4-mb-expand-item .amt.neg {
  color: #747474;
}
.v4-mb-expand-item .amt.pos {
  color: #d0343d;
}

/* V4 simple pagination */
.v4-mb-pagination {
  display: flex;
  justify-content: center;
  margin: 18px 0 0;
}
.v4-mb-page {
  position: relative;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #212121;
  font-weight: 700;
  /* JW 2026/01/15 分頁可能是 <button> 或 <a>，統一用 inline-flex 避免紅線定位錯位 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 30px;
  text-decoration: none;
}
.v4-mb-page.is-active:before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  background: #d0343d;
  border-radius: 3px;
}
.v4-mb-page.is-ellipsis {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 991px) {
  .v4-mb-metric-grid {
    grid-template-columns: 1fr;
  }
  .v4-mb-query-grid {
    grid-template-columns: 90px 1fr;
  }
  .v4-mb-date-wrap {
    grid-template-columns: 1fr;
  }
  .v4-mb-date-mid {
    display: none;
  }
}

body .v4-mb-tabs .tab-menu-swiper02 .swiper-slide {
  margin-bottom: -4px;
}

body .v4-mb-tabs .tab-menu-swiper02 {
  margin-left: 0px;
}
