.tag-list-page {
  width: min(1184px, calc(100% - 56px));
  min-height: 72vh;
  margin: 42px auto 110px;
}

.collection-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  overflow: hidden;
  padding: 48px 52px;
  background: var(--green);
  color: #fff;
}

.collection-header::after {
  position: absolute;
  right: -65px;
  bottom: -110px;
  width: 290px;
  height: 290px;
  border: 1px solid rgba(204, 239, 72, .34);
  border-radius: 50%;
  box-shadow: 0 0 0 46px rgba(204, 239, 72, .05), 0 0 0 92px rgba(204, 239, 72, .035);
  content: "";
}

.collection-copy {
  position: relative;
  z-index: 1;
  max-width: 670px;
}

.collection-copy .eyebrow {
  margin-bottom: 14px;
  color: #d5dfda;
}

.collection-copy h1 {
  font-size: clamp(3rem, 6vw, 5.2rem);
}

.collection-copy > p:last-child {
  max-width: 610px;
  margin: 18px 0 0;
  color: #cbd7d2;
  font-size: 1.02rem;
}

.collection-summary {
  position: relative;
  z-index: 1;
  display: flex;
  width: 150px;
  min-height: 135px;
  flex-direction: column;
  justify-content: center;
  padding: 21px;
  background: var(--lime);
  color: var(--ink);
}

.collection-summary strong {
  font: 800 3.5rem/1 Manrope, sans-serif;
}

.collection-summary span {
  margin-top: 8px;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.tag-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 40px 0 24px;
}

.tag-toolbar h2 {
  font-size: 1.65rem;
  letter-spacing: -.035em;
}

.tag-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.add-tag-button {
  gap: 10px;
}

.add-tag-button > span {
  font-size: 1.25rem;
  line-height: 1;
}

.tag-collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.managed-tag-card {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  min-width: 0;
  min-height: 360px;
  border: 1px solid #dfe2da;
  background: #fff;
  box-shadow: 0 12px 35px rgba(24, 50, 45, .065);
  transition: transform .18s ease, box-shadow .18s ease;
}

.managed-tag-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 45px rgba(24, 50, 45, .11);
}

.managed-tag-accent {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  overflow: hidden;
  background: var(--lime);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.managed-tag-accent span {
  position: absolute;
  top: 14px;
  right: 13px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -3px;
  transform: rotate(-45deg);
}

.managed-tag-body {
  padding: 30px 32px 25px;
}

.managed-tag-topline {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-right: 54px;
}

.managed-tag-type,
.managed-tag-status {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.managed-tag-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-tag-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #4f665f;
}

.managed-tag-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #77aa44;
  box-shadow: 0 0 0 4px #edf5df;
}

.managed-tag-card h3 {
  margin: 22px 0 20px;
  padding-right: 25px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  overflow-wrap: anywhere;
}

.uid-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #dce2d8;
  background: #f3f5ef;
}

.uid-block span,
.tag-detail-preview small {
  color: var(--muted);
  font-size: .63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.uid-block code {
  overflow: hidden;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
  text-overflow: ellipsis;
}

.tag-detail-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-top: 18px;
}

.tag-detail-preview > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.tag-detail-preview strong {
  overflow: hidden;
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-symbol {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #eaf2d0;
  color: var(--ink);
}

.automation-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 6px 10px;
  border-radius: 99px;
  background: #e8e0f8;
  color: #514472;
  font-size: .68rem;
  font-weight: 700;
}

.managed-tag-actions {
  display: flex;
  width: 100%;
  max-width: none;
  min-height: 64px;
  margin: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 20px 15px 32px;
  border-top: 1px solid #e2e5de;
  background: var(--cream);
}

.view-tag-action {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}

.view-tag-action span {
  margin-left: 5px;
}

.secondary-tag-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.secondary-tag-actions a,
.secondary-tag-actions button {
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 700 .76rem "DM Sans", sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.secondary-tag-actions form {
  margin: 0;
}

.secondary-tag-actions button {
  color: #a04436;
}

.collection-empty-state {
  display: flex;
  max-width: 720px;
  min-height: 420px;
  margin: 10px auto 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 55px;
  border: 1px dashed #bdc8bb;
  background: #f5f4ed;
  text-align: center;
}

.empty-tag-mark {
  position: relative;
  display: grid;
  width: 92px;
  height: 92px;
  margin-bottom: 25px;
  place-items: center;
  border: 7px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  transform: rotate(-8deg);
}

.empty-tag-mark span {
  font-weight: 800;
  letter-spacing: -4px;
  transform: rotate(-90deg);
}

.empty-tag-mark b {
  position: absolute;
  right: -11px;
  bottom: -7px;
  padding: 2px 7px;
  background: var(--ink);
  color: #fff;
  font-size: .65rem;
}

.collection-empty-state .eyebrow {
  margin-bottom: 12px;
}

.collection-empty-state h2 {
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.collection-empty-state > p:not(.eyebrow) {
  max-width: 500px;
  margin: 15px 0 30px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .tag-list-page {
    width: min(100% - 32px, 620px);
    margin-top: 24px;
  }

  .collection-header {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 36px 30px;
  }

  .collection-summary {
    width: 100%;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
  }

  .collection-summary strong {
    font-size: 2.5rem;
  }

  .collection-summary span {
    max-width: 130px;
    margin-top: 0;
  }

  .tag-collection-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .tag-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .add-tag-button {
    align-self: stretch;
  }

  .managed-tag-body {
    padding: 25px 20px 22px;
  }

  .managed-tag-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .uid-block {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .managed-tag-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 18px 20px;
  }

  .view-tag-action {
    padding: 9px 10px;
    background: var(--ink);
    color: #fff;
    text-align: center;
  }

  .secondary-tag-actions {
    justify-content: center;
  }

  .collection-empty-state {
    padding: 40px 22px;
  }
}
