.hero-card-compact {
  width: clamp(320px, 62%, 620px);
  margin-inline-start: 0;
  margin-inline-end: auto;
  min-height: 58px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-hero {
  position: relative;
  overflow: hidden;
}

.category-hero-content {
  position: relative;
  z-index: 3;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  opacity: 1;
  padding-left: 34px;
}

.category-hero .compact-back {
  position: absolute;
  left: 0;
  top: 1px;
}

.category-home-ghost,
.category-subcategory-preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
}

.category-home-ghost {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 22px 16px;
}

.category-home-ghost-logo {
  width: min(244px, 72%);
  height: 66px;
  border-radius: 22px;
  margin-inline: auto;
  background: linear-gradient(135deg, #f2f2ee 0%, #e9e9e5 100%);
  border: 1px dashed #cfcfc8;
}

.category-home-ghost-search {
  width: 100%;
  height: 44px;
  border-radius: var(--ui-r-soft);
  border: 1px solid #ddddd8;
  background: #fbfbf9;
}

.category-subcategory-preview {
  display: flex;
  align-items: center;
  padding: 0 44px 0 14px;
}

.subcategory-preview-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: #24241f;
}

.compact-back {
  color: #2b2b28;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.compact-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compact-hero-text {
  min-width: 0;
  flex: 1;
}

.compact-hero-title {
  margin: 0 10px 0 0;
  font-size: 0.9rem;
  color: #252521;
  text-align: right;
  line-height: 1.5;
}

.category-content {
  margin-top: 20px;
}

.category-stack {
  display: grid;
  gap: 12px;
}

.category-empty-state {
  width: min(94%, 100%);
  margin-inline: auto;
  border-radius: var(--ui-r-soft);
  border: 1px dashed #d8d8d2;
  background: #fcfcfa;
  padding: 14px 12px;
  min-height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-empty-state p {
  margin: 0;
  font-size: 0.82rem;
  color: #5b5b56;
  text-align: center;
  line-height: 1.9;
}

.main-category-card {
  width: min(94%, 100%);
  margin-inline: auto;
  border-radius: var(--ui-r-soft);
  border: 1px solid #e1e1dc;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(29, 29, 26, 0.07);
  overflow: hidden;
}

.main-category-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  text-align: right;
}

.main-category-heading {
  font-size: 0.98rem;
  font-weight: 700;
  color: #23231f;
}

.main-category-meta {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  color: #71716b;
  white-space: nowrap;
}

.main-category-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  transform: rotate(0deg);
  color: #75756f;
  transition: transform 320ms cubic-bezier(0.22, 0.8, 0.2, 1);
}

.main-category-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-category-card.is-open .main-category-chevron {
  transform: rotate(180deg);
}

.subcategory-panel {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  transition:
    max-height 420ms cubic-bezier(0.22, 0.8, 0.2, 1),
    opacity 220ms ease,
    transform 320ms ease;
}

.main-category-card.is-open .subcategory-panel {
  opacity: 1;
  transform: translateY(0);
}

.subcategory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.subcategory-cell {
  min-height: 92px;
  padding: 12px 10px;
  text-decoration: none;
  color: #2f2f2c;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border-left: 1px solid #efefeb;
  border-bottom: 1px solid #efefeb;
  transition: background 180ms ease;
}

.subcategory-cell:nth-child(2n) {
  border-left: 0;
}

.subcategory-cell:hover {
  background: rgba(241, 143, 45, 0.11);
}

.subcategory-cell-odd {
  grid-column: 1 / -1;
  flex-direction: row;
  gap: 14px;
  border-left: 0;
}

.subcategory-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(241, 143, 45, 0.2) 0%, rgba(241, 143, 45, 0.14) 100%);
  color: #603911;
}

.subcategory-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.subcategory-icon i {
  font-size: 18px;
  line-height: 1;
}

.subcategory-title {
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
}

html.didban-webapp body.page-categories .category-hero .compact-back {
  display: none;
}

html.didban-webapp body.page-categories .category-hero-content {
  padding-left: 0;
  justify-content: center;
  align-items: center;
  padding-top: var(--didban-webapp-title-row-top, 46px);
  padding-bottom: var(--didban-webapp-title-row-bottom, 16px);
  min-height: var(--didban-webapp-title-row-min-height, 38px);
}

html.didban-webapp body.page-categories .compact-hero-text {
  flex: 0 1 auto;
}

html.didban-webapp body.page-categories .compact-hero-title {
  margin: 0;
  text-align: center;
  font-weight: 700;
}

@media (max-width: 720px) {
  .hero-card-compact {
    width: 100%;
  }

  .category-home-ghost {
    padding-inline: 12px;
  }
}
