/* ============================================================
   TenderGlobal Card Standard v2 (Responsive Container-Query Card)
   Source of Truth: tendercard-Ar.html / tendercard-En.html
   ============================================================ */

:root {
  --tg-primary: #378B95;
  --tg-primary-dark: #2E7680;
  --tg-deep: #173F45;
  --tg-primary-soft: #EDF6F7;
  --tg-accent: #F5833D;
  --tg-accent-dark: #D96B2C;
  --tg-success: #4F7F24;
  --tg-success-soft: #F2F8EA;
  --tg-success-line: #D5E9C3;
  --tg-text: #273A40;
  --tg-secondary: #5F7278;
  --tg-muted: #8A999E;
  --tg-page: #F5F7F8;
  --tg-card: #FFFFFF;
  --tg-line: #DCE6E8;
  --tg-line-strong: #C7D9DC;
  --tg-radius: 12px;
  --tg-shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --tg-shadow-hover: 0 14px 34px rgba(23,63,69,.10);
}

.tg-wrap {
  width: 100%;
  max-width: 832px;
  margin: auto;
}

.tg-card {
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  background: var(--tg-card);
  border: 1px solid var(--tg-line);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 16px;
}

.tg-card:hover {
  transform: translateY(-2px);
  border-color: var(--tg-line-strong);
  box-shadow: var(--tg-shadow-hover);
}

.tg-card.is-expired {
  background: #F9FAFB;
  opacity: .92;
}

.tg-card__body {
  padding: 16px 18px;
}

/* Badges & ID */
.tg-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 9px;
}

.tg-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tg-badge {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--tg-primary-line, #C4E3E7);
  border-radius: 8px;
  color: var(--tg-primary-dark, #2E7680);
  background: var(--tg-primary-soft, #EDF6F7);
  font-size: .63rem;
  font-weight: 800;
  letter-spacing: .2px;
}

.tg-badge b {
  padding: 2px 7px;
  border-radius: 6px;
  color: #fff;
  background: var(--tg-primary, #378B95);
  font-size: .59rem;
  font-weight: 800;
  line-height: 1.3;
}

.tg-badge.is-expired {
  color: #64748B;
  background: #F1F5F9;
  border-color: #E2E8F0;
}

.tg-badge.is-expired b {
  background: #94A3B8;
}

.tg-id {
  margin-inline-start: auto;
  padding: 3px 9px;
  border: 1px solid var(--tg-line);
  border-radius: 8px;
  color: var(--tg-muted);
  background: var(--tg-page);
  font: 700 .65rem Consolas, Monaco, monospace;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[dir="rtl"] .tg-id {
  margin-right: auto;
  margin-left: 0;
}

html[dir="ltr"] .tg-id {
  margin-left: auto;
  margin-right: 0;
}

/* Title & Buyer */
.tg-title {
  margin: 0;
  color: #747474;
  font-size: 1.14rem;
  line-height: 1.45;
  font-weight: 800;
  letter-spacing: -.2px;
}

.tg-title a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}

.tg-title a:hover {
  color: var(--tg-primary-dark);
}

/* Publisher Above Title */
.tg-pub-banner {
  margin-bottom: 5px;
}

.tg-pub-banner__icon {
  display: none;
}

.tg-pub-banner__name {
  font-size: .82rem;
  font-weight: 700;
  color: var(--tg-primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-pub-banner__name a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}

.tg-pub-banner__name a:hover {
  color: var(--tg-accent-dark, #C0612A);
  text-decoration: none;
}

.tg-buyer-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
}

.tg-buyer {
  color: var(--tg-deep);
  font-size: .79rem;
  font-weight: 700;
  text-decoration: none;
  transition: color .2s;
}

a.tg-buyer:hover {
  color: var(--tg-primary-dark);
  text-decoration: underline;
}

.tg-buyer--sector {
  color: var(--tg-secondary);
  font-weight: 600;
}

.tg-city {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 5px 12px 5px 5px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fafbfc 0%, #f2f5f7 100%);
  border: 1px solid #e2e8ed;
  font-size: .72rem;
  font-weight: 600;
  color: var(--tg-text, #1a2b3c);
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: all 0.2s ease;
}

.tg-city:hover {
  background: linear-gradient(135deg, #eef6f7 0%, #e4f0f2 100%);
  border-color: var(--tg-primary-line, #C4E3E7);
  box-shadow: 0 2px 8px rgba(55, 139, 149, 0.12);
}

.tg-flag-square,
.tg-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.tg-flag-square img,
.tg-flag-square-img,
.tg-flag img,
.tg-flag-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.tg-city-name { font-weight: 600; color: var(--tg-text, #1a2b3c); }
.tg-country-name { display: none; }

/* Meta 3-column row with Prominent 44px Icons */
.tg-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 15px;
  padding: 12px 0;
  border-top: 1px solid var(--tg-line);
  border-bottom: 1px solid var(--tg-line);
}

/* 2-Column Meta Layout when copy price is hidden (50/50 division with zero empty space) */
.tg-meta.tg-meta--2col,
.tg-meta:not(:has(.tg-meta__item--price)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tg-meta__item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
}

.tg-meta__item + .tg-meta__item {
  border-inline-start: 1px solid var(--tg-line);
}

.tg-meta__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 10px;
  color: var(--tg-primary-dark);
  background: var(--tg-primary-soft);
  border: 1px solid var(--tg-primary-line, #C4E3E7);
  box-shadow: 0 1px 3px rgba(55, 139, 149, 0.06);
  transition: all 0.2s ease;
}

.tg-meta__icon svg {
  width: 22px;
  height: 22px;
}

.tg-meta__icon i {
  font-size: 20px;
  color: var(--tg-primary-dark);
}

/* Currency Code Square — replaces the generic icon for price */
.tg-meta__item--price .tg-meta__icon,
.tg-price-sq {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--tg-primary-soft);
  border: 1px solid var(--tg-primary-line, #C4E3E7);
  box-shadow: 0 1px 3px rgba(55, 139, 149, 0.06);
}

.tg-price-sq__code {
  font-size: .62rem;
  font-weight: 900;
  color: var(--tg-primary-dark);
  letter-spacing: .03em;
  line-height: 1;
}

.tg-price-sq__name {
  font-size: .38rem;
  font-weight: 600;
  color: var(--tg-secondary);
  line-height: 1;
  opacity: .85;
}

/* Free state */
.tg-price-sq.is-free {
  background: #f0f9e0;
  border-color: #d5edb8;
}

.tg-price-sq.is-free .tg-price-sq__code { color: #568b12; }
.tg-price-sq.is-free .tg-price-sq__name { color: #6a9a2a; }

/* Price text styling */
.tg-meta__item--price .tg-meta__copy strong {
  color: #747474;
}

.tg-meta__item--price .tg-cur-tag {
  font-size: .5rem;
  font-weight: 800;
  color: var(--tg-primary);
  background: var(--tg-primary-soft);
  border-radius: 999px;
  padding: 2px 6px;
  margin-inline-start: 4px;
  vertical-align: middle;
}

.tg-meta__item--price.is-free .tg-meta__copy strong { color: #568b12; }
.tg-meta__item--price.is-free .tg-cur-tag { color: #568b12; background: #f0f9e0; }

.tg-meta__copy {
  min-width: 0;
}

.tg-meta__copy small {
  display: block;
  color: var(--tg-secondary);
  font-size: .60rem;
  font-weight: 600;
}

.tg-meta__copy strong {
  display: block;
  margin-top: 2px;
  color: var(--tg-text);
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modern SaaS Progress Around Square (44px, 10px radius) */
.tg-square-progress {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--tg-primary-soft, #EDF6F7);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
}

.tg-square-progress:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(55, 139, 149, 0.18);
}

.tg-square-progress__svg {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  pointer-events: none;
  overflow: visible;
}

.tg-square-progress__svg rect.bg {
  fill: none;
  stroke: rgba(55, 139, 149, 0.16);
  stroke-width: 2.6;
}

.tg-square-progress__svg rect.bar {
  fill: none;
  stroke: var(--tg-primary, #378B95);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
  filter: drop-shadow(0 1px 2px rgba(55, 139, 149, 0.25));
}

.tg-square-progress.is-urgent {
  background: #FEF2F2;
}

.tg-square-progress.is-urgent .tg-square-progress__svg rect.bg {
  stroke: rgba(220, 38, 38, 0.16);
}

.tg-square-progress.is-urgent .tg-square-progress__svg rect.bar {
  stroke: #DC2626;
  filter: drop-shadow(0 1px 3px rgba(220, 38, 38, 0.35));
}

.tg-square-progress.is-warning {
  background: #FFFBEB;
}

.tg-square-progress.is-warning .tg-square-progress__svg rect.bar {
  stroke: #F5833D;
  filter: drop-shadow(0 1px 3px rgba(245, 131, 61, 0.30));
}

.tg-square-progress__icon {
  position: relative;
  z-index: 1;
  color: var(--tg-primary-dark, #2E7680);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  transition: color 0.2s ease;
}

.tg-square-progress.is-urgent .tg-square-progress__icon {
  color: #DC2626;
}

.tg-square-progress.is-warning .tg-square-progress__icon {
  color: #D97706;
}

.tg-square-progress__icon svg {
  width: 21px;
  height: 21px;
}

/* Number + Unit inside the square */
.tg-sq-num {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.tg-sq-unit {
  font-size: .48rem;
  font-weight: 600;
  line-height: 1;
  margin-top: 1px;
  opacity: 0.85;
  text-transform: capitalize;
}

.tg-sq-label {
  font-size: .48rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  word-break: keep-all;
}

/* Inline Days Countdown Badge inside the copy */
.tg-deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--tg-primary-soft, #EDF6F7);
  border: 1px solid var(--tg-primary-line, #C4E3E7);
  color: var(--tg-primary-dark, #2E7680);
  font-size: .60rem;
  font-weight: 800;
  line-height: 1.3;
}

.tg-deadline-badge.is-urgent {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #DC2626;
}

.tg-deadline-badge.is-warning {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #D97706;
}

/* Legacy/Circular Countdown fallback */
.tg-countdown {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #EDF6F7 0%, #E0EFF1 100%);
  border: 1px solid var(--tg-primary-line, #C4E3E7);
  box-shadow: 0 1px 3px rgba(55, 139, 149, 0.06);
  transition: all 0.2s ease;
}

.tg-countdown:hover {
  transform: translateY(-1px);
  border-color: var(--tg-primary);
  box-shadow: 0 4px 12px rgba(55, 139, 149, 0.15);
}

.tg-countdown svg.countdown-circle {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.tg-countdown circle.bg { stroke: rgba(55,139,149,0.16); stroke-width: 3.2; fill: none; }
.tg-countdown circle.bar {
  stroke: var(--tg-primary);
  stroke-width: 3.2;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 1px 2px rgba(55, 139, 149, 0.25));
}

.tg-countdown span {
  position: relative;
  z-index: 1;
  color: var(--tg-primary-dark);
  text-align: center;
  line-height: .92;
  font-weight: 900;
}

.tg-countdown b {
  display: block;
  font-size: .84rem;
  letter-spacing: -0.2px;
}

.tg-countdown small {
  display: block;
  margin-top: 1px;
  font-size: .42rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.85;
}

/* Actions bar */
.tg-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.tg-actions__primary,
.tg-actions__icons {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tg-actions__icons {
  justify-content: flex-end;
}

/* Unified Split Button for Details + Open in New Window (Gray) */
.tg-btn-split {
  height: 44px;
  display: inline-flex;
  align-items: stretch;
  border: none;
  border-radius: 10px;
  background: #F8F9FA;
  overflow: hidden;
  border: 1px solid rgba(100,116,125,0.15);
  box-shadow: 0 1px 2px rgba(100,116,125,0.08), 0 4px 12px rgba(100,116,125,0.06);
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.tg-btn-split:hover {
  transform: translateY(-1px);
  border-color: rgba(100,116,125,0.3);
  box-shadow: 0 2px 6px rgba(100,116,125,0.12), 0 8px 20px rgba(100,116,125,0.1);
}

.tg-btn-split__main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: #F5833D;
  font-size: .80rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  transition: background .2s ease, color .2s ease;
  text-decoration: none;
}

.tg-btn-split__main:hover {
  background: #EDF2F7;
  color: #2D3748;
}

.tg-btn-split__icon {
  width: 38px;
  display: grid;
  place-items: center;
  color: #4A5568;
  border-inline-start: 1.5px solid rgba(100, 116, 125, 0.2);
  transition: background .2s ease, color .2s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.tg-btn-split__icon:hover {
  background: #EDF2F7;
  color: #2D3748;
}

.tg-btn-split__icon svg { width: 17px; height: 17px; }

/* Fallback tg-details */
.tg-details {
  min-width: 118px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1.5px solid #CBD5E0;
  border-radius: 10px;
  color: #4A5568;
  background: #FFFFFF;
  font-size: .78rem;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(100,116,125,.06);
  transition: all .2s ease;
  cursor: pointer;
  text-decoration: none;
}

.tg-details:hover {
  transform: translateY(-1px);
  background: #EDF2F7;
  color: #2D3748;
  border-color: #A0AEC0;
  box-shadow: 0 4px 14px rgba(100,116,125,.18);
}

.tg-icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid var(--tg-line);
  border-radius: 10px;
  color: var(--tg-secondary);
  background: #fff;
  transition: all .2s ease;
  cursor: pointer;
  text-decoration: none;
}

.tg-icon-btn svg {
  width: 20px;
  height: 20px;
}

.tg-icon-btn .tg-icon-img {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

.tg-icon-btn:hover {
  transform: translateY(-1px);
  color: var(--tg-primary-dark);
  border-color: var(--tg-primary);
}

.tg-icon-btn--accent {
  color: var(--tg-accent);
}

.tg-icon-btn.is-fav,
.tg-icon-btn.tf-favorited,
.tg-icon-btn.active {
  color: var(--tg-accent) !important;
  border-color: var(--tg-accent) !important;
  background: rgba(245, 131, 61, 0.08) !important;
}

.tg-icon-btn.is-fav svg,
.tg-icon-btn.tf-favorited svg,
.tg-icon-btn.active svg {
  fill: currentColor !important;
}

/* Strictly hide any stray <i> icons inside tg-icon-btn to prevent double-star bugs */
.tg-icon-btn i,
.tg-icon-btn .tf-star-icon {
  display: none !important;
}

/* Action Icons Standardization across Default, TendersSearch, AdvancedSearch */
.tg-card .tg-icon-btn,
.tg-card .tf-star-button,
.tg-card button.tf-star-button {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  border-radius: 10px !important;
  aspect-ratio: 1 / 1 !important;
  flex: 0 0 44px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure tf-star-button adheres to tg-icon-btn design tokens */
.tg-icon-btn.tf-star-button {
  width: 44px !important;
  height: 44px !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  margin: 0 !important;
  border: 1px solid var(--tg-line) !important;
  background: #fff !important;
  color: var(--tg-accent) !important;
}

.tg-icon-btn.tf-star-button:hover {
  transform: translateY(-1px) !important;
  border-color: var(--tg-accent) !important;
  background: #fff !important;
  box-shadow: 0 4px 12px rgba(245, 131, 61, 0.15) !important;
}

.tg-icon-btn.tf-star-button.active,
.tg-icon-btn.tf-star-button.is-fav {
  background: rgba(245, 131, 61, 0.08) !important;
  border-color: var(--tg-accent) !important;
  color: var(--tg-accent) !important;
  animation: none !important;
}

.tg-icon-btn.tf-star-button.active:hover {
  background: rgba(245, 131, 61, 0.14) !important;
  transform: translateY(-1px) !important;
}

.tg-notice {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 10px;
  color: #fff;
  background: #AEBCC0;
  font-size: .56rem;
  font-weight: 800;
  line-height: 1;
}

/* Category accordion */
.tg-category {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--tg-line);
  border-radius: 10px;
  background: var(--tg-page);
  transition: all .2s ease;
}

.tg-category__toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  color: var(--tg-primary-dark);
  background: transparent;
  text-align: start;
  cursor: pointer;
}

.tg-category__start {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.tg-category__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  border: 1px solid var(--tg-line);
  border-radius: 8px;
  color: var(--tg-primary);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tg-category__icon svg {
  width: 19px;
  height: 19px;
}

/* Dynamic Category Icon Switch: Closed vs Opened */
.tg-category .tg-cat-icon--open { display: none; }
.tg-category .tg-cat-icon--closed { display: block; }
.tg-category.is-open .tg-cat-icon--closed { display: none; }
.tg-category.is-open .tg-cat-icon--open { display: block; }

.tg-category.is-open .tg-category__icon {
  background: var(--tg-primary-soft, #EDF6F7);
  border-color: var(--tg-primary, #378B95);
  color: var(--tg-primary-dark, #2E7680);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(55,139,149,0.20);
}

.tg-category__icon img.tg-cat-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.tg-category__copy {
  min-width: 0;
}

.tg-category__copy strong {
  display: block;
  color: var(--tg-text);
  font-size: .74rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-category__copy span {
  display: block;
  margin-top: 1px;
  color: var(--tg-muted);
  font-size: .60rem;
}

.tg-category__end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tg-category__count {
  padding: 3px 9px;
  border: 1px solid var(--tg-line);
  border-radius: 8px;
  color: var(--tg-text);
  background: #fff;
  font-size: .60rem;
  font-weight: 800;
}

.tg-category__arrow {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--tg-line);
  color: var(--tg-primary-dark);
  transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1), background .2s ease, border-color .2s ease, color .2s ease;
  flex-shrink: 0;
}

.tg-category__arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

.tg-category__toggle:hover .tg-category__arrow {
  color: var(--tg-primary);
  border-color: var(--tg-primary-line);
  background: var(--tg-primary-soft);
}

.tg-category.is-open .tg-category__arrow {
  transform: rotate(180deg);
  color: var(--tg-primary);
  background: var(--tg-primary-soft);
  border-color: var(--tg-primary-line);
}

.tg-category__panel {
  display: none;
  padding: 12px 14px;
  border-top: 1px solid var(--tg-line);
  background: #fff;
}

.tg-category.is-open .tg-category__panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tg-cat {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--tg-line);
  border-radius: 8px;
  background: var(--tg-page);
  font-size: .66rem;
  font-weight: 700;
  transition: all 0.18s ease;
}

.tg-cat:hover {
  border-color: var(--tg-primary);
  background: #fff;
  box-shadow: 0 2px 8px rgba(55, 139, 149, 0.14);
}

.tg-cat__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #fff;
  border-inline-end: 1px solid var(--tg-line);
  color: var(--tg-primary);
}

.tg-cat__icon svg {
  width: 15px;
  height: 15px;
}

.tg-cat__icon img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 3px;
}

.tg-cat b {
  padding: 5px 9px;
  color: var(--tg-primary-dark);
  background: var(--tg-primary-soft);
  font-weight: 800;
}

.tg-cat .tg-cat__name,
.tg-cat span {
  padding: 5px 9px;
  color: var(--tg-secondary);
  border-inline-start: 1px solid var(--tg-line);
}

.tg-cat .tg-cat__num,
.tg-cat code {
  padding: 2px 7px;
  margin-inline-start: 2px;
  margin-inline-end: 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.05);
  color: var(--tg-muted);
  font: 700 .62rem Consolas, Monaco, monospace;
  direction: ltr;
}

/* Container Queries for fully responsive cards */
@container (max-width: 759px) {
  .tg-card__body { padding: 14px; }
  .tg-title { font-size: 1.06rem; }
  .tg-meta__item { gap: 6px; padding: 0 6px; }
  .tg-actions { grid-template-columns: auto minmax(0, 1fr); }
  .tg-details { min-width: 112px; height: 44px; padding-inline: 18px; }
  .tg-icon-btn { width: 44px; height: 44px; flex-basis: 44px; }
  .tg-actions__icons { gap: 7px; }
}

@container (max-width: 479px) {
  .tg-card__body { padding: 12px; }
  .tg-title { font-size: 1rem; }
  .tg-buyer { font-size: .74rem; }
  .tg-id { max-width: 46%; font-size: .58rem; }
  .tg-meta__item {
    min-height: 62px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 3px;
    text-align: center;
  }
  .tg-meta__icon { width: 31px; height: 31px; flex-basis: 31px; }
  .tg-countdown { width: 34px; height: 34px; flex-basis: 34px; }
  .tg-meta__copy small { font-size: .51rem; }
  .tg-meta__copy strong { font-size: .63rem; }
  .tg-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .tg-actions__primary {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .tg-btn-split {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }
  .tg-btn-split__main {
    flex: 1;
  }
  .tg-details { flex: 1; min-width: 0; }
  .tg-actions__icons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }
  .tg-actions__icons .tg-icon-btn,
  .tg-card .tg-actions__icons .tg-icon-btn,
  .tg-card .tg-icon-btn,
  .tg-card .tf-star-button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 10px !important;
    aspect-ratio: 1 / 1 !important;
  }
  .tg-category__copy span { display: none; }
  .tg-category__count { white-space: nowrap; }
}

@media (max-width: 768px) {
  .tg-card .tg-icon-btn,
  .tg-card .tf-star-button,
  .tg-card button.tf-star-button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    border-radius: 10px !important;
    aspect-ratio: 1 / 1 !important;
    flex: 0 0 44px !important;
  }
}
