.mab-brands {
  --mab-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --mab-accent: #d90d28;
  --mab-accent-hover: #b80921;
  --mab-accent-text: #e11d38;
  --mab-accent-glow: rgba(217, 13, 40, 0.28);
  --mab-cta-text: #ffffff;
  --mab-card-bg: #f3f2ef;
  --mab-card-border: rgba(17, 24, 39, 0.06);
  --mab-card-text: #111827;
  --mab-card-muted: #4b5563;
  --mab-pill-bg: #ffffff;
  --mab-pill-text: #1f2937;
  --mab-ring-track: rgba(17, 24, 39, 0.1);
  --mab-featured-bg: #0c0e12;
  --mab-featured-text: #ffffff;
  --mab-featured-pill-bg: rgba(255, 255, 255, 0.12);
  --mab-featured-pill-text: #e5e7eb;
  --mab-featured-ring-track: rgba(255, 255, 255, 0.14);
  --mab-radius: 16px;
  --mab-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  --mab-shadow-hover: 0 10px 28px rgba(15, 23, 42, 0.1);

  font-family: var(--mab-font);
  container-type: inline-size;
  width: 100%;
  box-sizing: border-box;
}

.mab-brands--theme-emerald {
  --mab-accent: #059669;
  --mab-accent-hover: #047857;
  --mab-accent-text: #059669;
  --mab-accent-glow: rgba(5, 150, 105, 0.28);
  --mab-card-bg: #f2f7f4;
  --mab-featured-bg: #071f18;
}

.mab-brands--theme-royal {
  --mab-accent: #2563eb;
  --mab-accent-hover: #1d4ed8;
  --mab-accent-text: #2563eb;
  --mab-accent-glow: rgba(37, 99, 235, 0.28);
  --mab-card-bg: #f1f5f9;
  --mab-featured-bg: #0f172a;
}

.mab-brands--theme-gold {
  --mab-accent: #f59e0b;
  --mab-accent-hover: #d97706;
  --mab-accent-text: #d97706;
  --mab-accent-glow: rgba(245, 158, 11, 0.3);
  --mab-cta-text: #111827;
  --mab-card-bg: #faf7f0;
  --mab-featured-bg: #141210;
}

.mab-brands--theme-dark {
  --mab-accent: #7c3aed;
  --mab-accent-hover: #6d28d9;
  --mab-accent-text: #a78bfa;
  --mab-accent-glow: rgba(124, 58, 237, 0.35);
  --mab-card-bg: #161822;
  --mab-card-border: rgba(255, 255, 255, 0.08);
  --mab-card-text: #f9fafb;
  --mab-card-muted: #9ca3af;
  --mab-pill-bg: rgba(255, 255, 255, 0.09);
  --mab-pill-text: #e5e7eb;
  --mab-ring-track: rgba(255, 255, 255, 0.14);
  --mab-featured-bg: #0a0b10;
}

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

.mab-brands__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
}

.mab-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 104px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px 24px;
  background: var(--mab-card-bg);
  border: 1px solid var(--mab-card-border);
  border-radius: var(--mab-radius);
  color: var(--mab-card-text);
  box-shadow: var(--mab-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.mab-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--mab-shadow-hover);
}

.mab-card--featured {
  background: var(--mab-featured-bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--mab-featured-text);
  padding-top: 24px;
  padding-bottom: 22px;
}

.mab-card__badge {
  position: absolute;
  top: -11px;
  left: 72px;
  padding: 5px 14px;
  border-radius: 8px;
  background: var(--mab-accent);
  color: var(--mab-cta-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 4px 12px var(--mab-accent-glow);
}

.mab-card__rank {
  font-size: 20px;
  font-weight: 800;
  color: var(--mab-card-text);
  text-align: center;
  line-height: 1;
}

.mab-card--featured .mab-card__rank {
  color: var(--mab-accent-text);
}

.mab-card__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 74px;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.mab-card__logo {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.mab-card__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mab-brands .mab-card__title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--mab-card-text) !important;
}

.mab-brands .mab-card--featured .mab-card__title {
  color: var(--mab-featured-text) !important;
}

.mab-card__bonus {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: inherit;
}

.mab-card__bonus-accent {
  color: var(--mab-accent-text);
  font-weight: 700;
}

.mab-brands .mab-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none !important;
}

.mab-brands .mab-card__pill {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--mab-pill-bg);
  color: var(--mab-pill-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  list-style: none !important;
}

.mab-brands .mab-card__pill::before {
  content: none !important;
  display: none !important;
}

.mab-card--featured .mab-card__pill {
  background: var(--mab-featured-pill-bg);
  color: var(--mab-featured-pill-text);
  backdrop-filter: blur(8px);
}

.mab-card__actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.mab-rating {
  position: relative;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mab-rating__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}

.mab-rating__track,
.mab-rating__progress {
  fill: none;
  stroke-width: 5.5;
}

.mab-rating__track {
  stroke: var(--mab-ring-track);
}

.mab-card--featured .mab-rating__track {
  stroke: var(--mab-featured-ring-track);
}

.mab-rating__progress {
  stroke: var(--mab-accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.mab-rating__value {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}

.mab-rating__score {
  font-size: 17px;
  font-weight: 800;
  color: inherit;
}

.mab-rating__label {
  margin-top: 2px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--mab-card-muted);
  text-transform: uppercase;
}

.mab-card--featured .mab-rating__label {
  color: #9ca3af;
}

.mab-brands a.mab-card__cta,
.mab-brands a.mab-card__cta:link,
.mab-brands a.mab-card__cta:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 156px;
  padding: 15px 24px;
  border-radius: 999px;
  background: var(--mab-accent);
  color: var(--mab-cta-text) !important;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none !important;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 6px 18px var(--mab-accent-glow);
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.mab-brands a.mab-card__cta span {
  color: inherit !important;
  text-decoration: none !important;
}

.mab-brands a.mab-card__cta:hover,
.mab-brands a.mab-card__cta:focus-visible {
  background: var(--mab-accent-hover);
  color: var(--mab-cta-text) !important;
  text-decoration: none !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--mab-accent-glow);
  outline: none;
}

.mab-card__cta-icon {
  flex-shrink: 0;
  color: inherit;
  transition: transform 0.2s ease;
}

.mab-brands a.mab-card__cta:hover .mab-card__cta-icon {
  transform: translate(2px, -2px);
}

/* Template: Compact */
.mab-brands--tpl-compact .mab-brands__list {
  gap: 10px;
}

.mab-brands--tpl-compact .mab-card {
  grid-template-columns: 28px 82px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 12px;
}

.mab-brands--tpl-compact .mab-card--featured {
  padding-top: 16px;
}

.mab-brands--tpl-compact .mab-card__badge {
  top: -10px;
  left: 60px;
  padding: 4px 10px;
  font-size: 10px;
}

.mab-brands--tpl-compact .mab-card__logo-wrap {
  width: 82px;
  height: 54px;
  padding: 6px 8px;
  border-radius: 9px;
}

.mab-brands--tpl-compact .mab-card__title {
  font-size: 16px;
}

.mab-brands--tpl-compact .mab-card__bonus {
  font-size: 13.5px;
}

.mab-brands--tpl-compact .mab-card__pill {
  padding: 3px 9px;
  font-size: 11px;
}

.mab-brands--tpl-compact .mab-rating {
  width: 54px;
  height: 54px;
}

.mab-brands--tpl-compact .mab-rating__score {
  font-size: 14px;
}

.mab-brands--tpl-compact .mab-rating__label {
  font-size: 7.5px;
}

.mab-brands--tpl-compact a.mab-card__cta {
  min-width: 132px;
  padding: 11px 18px;
  font-size: 12px;
}

/* Template: Glassmorphism */
.mab-brands--tpl-glass .mab-card {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

.mab-brands--tpl-glass.mab-brands--theme-dark .mab-card {
  background: rgba(22, 24, 34, 0.72);
  border-color: rgba(255, 255, 255, 0.14);
}

.mab-brands--tpl-glass .mab-card--featured {
  background: rgba(12, 14, 18, 0.86);
  border-color: var(--mab-accent);
  box-shadow: 0 12px 34px var(--mab-accent-glow);
}

/* Template: Grid */
.mab-brands--tpl-grid .mab-brands__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.mab-brands--tpl-grid .mab-card {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding: 24px 20px 20px;
}

.mab-brands--tpl-grid .mab-card__badge {
  left: 50%;
  transform: translateX(-50%);
}

.mab-brands--tpl-grid .mab-card__rank {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 16px;
}

.mab-brands--tpl-grid .mab-card__logo-wrap {
  width: 120px;
  height: 76px;
}

.mab-brands--tpl-grid .mab-card__meta {
  justify-content: center;
}

.mab-brands--tpl-grid .mab-card__actions {
  width: 100%;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.mab-brands--tpl-grid .mab-card--featured .mab-card__actions,
.mab-brands--tpl-grid.mab-brands--theme-dark .mab-card__actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.mab-brands--tpl-grid a.mab-card__cta {
  width: 100%;
}

/* Template: Grid 2 (First full-width, others 2 per row) */
.mab-brands--tpl-grid2 .mab-brands__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.mab-brands--tpl-grid2 .mab-card:first-child {
  grid-column: 1 / -1;
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding: 24px 20px 20px;
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) .mab-card__badge {
  left: 50%;
  transform: translateX(-50%);
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) .mab-card__rank {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 16px;
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) .mab-card__logo-wrap {
  width: 120px;
  height: 76px;
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) .mab-card__meta {
  justify-content: center;
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) .mab-card__actions {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child).mab-card--featured .mab-card__actions,
.mab-brands--tpl-grid2.mab-brands--theme-dark .mab-card:not(:first-child) .mab-card__actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.mab-brands--tpl-grid2 .mab-card:not(:first-child) a.mab-card__cta {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
}

/* Template: Table */
.mab-table-wrap {
  width: 100%;
  border-radius: var(--mab-radius);
  border: 1px solid var(--mab-card-border);
  background: var(--mab-card-bg);
  box-shadow: var(--mab-shadow);
  overflow: hidden;
}

.mab-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--mab-card-text);
  text-align: left;
}

.mab-table thead th {
  padding: 13px 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mab-card-muted);
  border-bottom: 1px solid var(--mab-card-border);
  background: rgba(0, 0, 0, 0.025);
}

.mab-brands--theme-dark .mab-table thead th {
  background: rgba(255, 255, 255, 0.03);
}

.mab-table__row {
  border-bottom: 1px solid var(--mab-card-border);
  transition: background-color 0.15s ease;
}

.mab-table__row:last-child {
  border-bottom: 0;
}

.mab-table__row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.mab-table__row--featured {
  background: var(--mab-featured-bg);
  color: var(--mab-featured-text);
}

.mab-table__row--featured:hover {
  background: var(--mab-featured-bg);
}

.mab-table__cell {
  padding: 14px 16px;
  vertical-align: middle;
}

.mab-table__cell--rank {
  width: 44px;
  text-align: center;
}

.mab-table__rank {
  font-size: 16px;
  font-weight: 800;
}

.mab-table__row--featured .mab-table__rank {
  color: var(--mab-accent-text);
}

.mab-table__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mab-table__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 46px;
  padding: 6px 8px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.mab-table__logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mab-table__name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

.mab-table__badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--mab-accent);
  color: var(--mab-cta-text);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mab-table__bonus {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.mab-table__row--featured .mab-card__pill {
  background: var(--mab-featured-pill-bg);
  color: var(--mab-featured-pill-text);
}

.mab-table__rating {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid var(--mab-accent);
  line-height: 1.1;
}

.mab-table__score {
  font-size: 15px;
  font-weight: 800;
}

.mab-table__rating-label {
  margin-top: 2px;
  font-size: 8px;
  font-weight: 700;
  color: var(--mab-card-muted);
  text-transform: uppercase;
}

.mab-table__row--featured .mab-table__rating-label {
  color: #9ca3af;
}

.mab-table__cell--cta {
  text-align: right;
}

.mab-table__cell--cta a.mab-card__cta {
  min-width: 136px;
  padding: 11px 18px;
  font-size: 12px;
}

@container (max-width: 780px) {
  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card {
    grid-template-columns: 28px 88px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__logo-wrap,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__logo-wrap {
    width: 88px;
    height: 64px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__badge,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__badge {
    left: 56px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__actions,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__actions {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card--featured .mab-card__actions,
  .mab-brands--theme-dark:not(.mab-brands--tpl-grid) .mab-card__actions {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child a.mab-card__cta,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) a.mab-card__cta {
    flex: 1;
    max-width: 260px;
  }
}

@container (max-width: 740px) {
  .mab-table thead {
    display: none;
  }

  .mab-table,
  .mab-table tbody,
  .mab-table__row,
  .mab-table__cell {
    display: block;
    width: 100%;
  }

  .mab-table__row {
    position: relative;
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    align-items: center;
  }

  .mab-table__cell {
    padding: 0;
  }

  .mab-table__cell--rank {
    position: absolute;
    top: 14px;
    right: 16px;
    width: auto;
  }

  .mab-table__cell--brand {
    grid-column: 1 / -1;
    padding-right: 28px;
  }

  .mab-table__cell--bonus,
  .mab-table__cell--terms {
    grid-column: 1 / -1;
  }

  .mab-table__cell--rating {
    grid-column: 1;
    justify-self: start;
  }

  .mab-table__cell--cta {
    grid-column: 2;
    text-align: right;
  }
}

@container (max-width: 680px) {
  .mab-brands--tpl-grid .mab-brands__list,
  .mab-brands--tpl-grid2 .mab-brands__list {
    grid-template-columns: 1fr;
  }
}

@container (max-width: 480px) {
  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__logo-wrap,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__logo-wrap {
    grid-column: 2;
    width: 100%;
    max-width: 120px;
    height: 60px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__badge,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__badge {
    left: 16px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__info,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__info {
    grid-column: 1 / -1;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child .mab-card__actions,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) .mab-card__actions {
    gap: 12px;
  }

  .mab-brands:not(.mab-brands--tpl-grid) .mab-card:first-child a.mab-card__cta,
  .mab-brands:not(.mab-brands--tpl-grid):not(.mab-brands--tpl-grid2) a.mab-card__cta {
    min-width: 0;
    padding: 13px 18px;
  }

  .mab-table__row {
    grid-template-columns: 1fr;
  }

  .mab-table__cell--cta {
    grid-column: 1;
    text-align: left;
  }

  .mab-table__cell--cta a.mab-card__cta {
    width: 100%;
  }
}
