.sales-studio-main {
  min-height: calc(100vh - var(--topbar-height));
  padding: 28px 36px 0;
}

.sales-template-page {
  display: grid;
  gap: 22px;
  width: min(100%, 1660px);
  margin: 0 auto;
}

.sales-template-tabs {
  position: sticky;
  top: var(--topbar-height);
  z-index: 8;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 174, 84, 0.2);
  border-radius: 14px;
  background: rgba(8, 13, 23, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
}

.sales-template-tabs-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sales-template-tabs-title span,
.sales-template-heading span,
.sales-template-card-copy span {
  color: #ffb35f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sales-template-tabs-title strong {
  color: #fff;
  font-size: 15px;
}

.sales-template-tab-list {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 174, 84, 0.52) rgba(255, 255, 255, 0.06);
}

.sales-template-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 174, 84, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #d7e2f1;
  font-size: 12px;
  font-weight: 800;
}

.sales-template-tab:hover,
.sales-template-tab:focus-visible,
.sales-template-tab.is-selected {
  outline: none;
  border-color: rgba(255, 192, 103, 0.86);
  background: linear-gradient(135deg, rgba(255, 138, 29, 0.9), rgba(255, 79, 139, 0.86));
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 138, 29, 0.22);
}

.sales-template-stage {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 174, 84, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 138, 29, 0.13), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(34, 207, 255, 0.11), transparent 32%),
    linear-gradient(145deg, rgba(11, 16, 27, 0.96), rgba(6, 10, 18, 0.98));
}

.sales-template-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.sales-template-heading h1 {
  margin-top: 4px;
  color: #fff;
  font-size: clamp(24px, 2.4vw, 38px);
  line-height: 1.15;
}

.sales-template-heading p {
  max-width: 720px;
  margin-top: 8px;
  color: #95a7bd;
  font-size: 13px;
}

.sales-template-heading > strong {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid rgba(255, 192, 103, 0.5);
  border-radius: 999px;
  background: rgba(255, 138, 29, 0.12);
  color: #ffd49b;
  font-size: 12px;
}

.sales-template-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.sales-template-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(65, 82, 112, 0.7);
  border-radius: 14px;
  background: rgba(13, 20, 33, 0.9);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sales-template-card.is-selected {
  border-color: rgba(255, 192, 103, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 138, 29, 0.16), 0 18px 34px rgba(0, 0, 0, 0.34), 0 0 22px rgba(255, 138, 29, 0.18);
}

.sales-template-card:focus-within,
.sales-template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 192, 103, 0.74);
}

.sales-template-preview {
  position: relative;
  aspect-ratio: 9 / 16;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.58)),
    #101827;
}

.sales-template-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.sales-template-preview::after {
  content: '9:16';
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(2, 7, 15, 0.74);
  color: #eaf5ff;
  font-size: 10px;
  font-weight: 800;
}

.sales-template-preview.google-preview span {
  position: absolute;
  inset: auto auto 12px 12px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853, #fbbc05, #ea4335);
  color: #fff;
  font-weight: 900;
}

.sales-template-card-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sales-template-card-copy h2 {
  color: #fff;
  font-size: 15px;
  line-height: 1.25;
}

.sales-template-card-copy p {
  color: #9dafc4;
  font-size: 11.5px;
  line-height: 1.55;
}

.sales-template-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sales-template-card button {
  min-height: 36px;
  border: 1px solid rgba(255, 174, 84, 0.42);
  border-radius: 9px;
  background: rgba(255, 138, 29, 0.1);
  color: #ffd49b;
  font-size: 12px;
  font-weight: 800;
}

.sales-template-card .sales-template-preview-button {
  border-color: rgba(122, 202, 255, 0.34);
  background: rgba(34, 207, 255, 0.08);
  color: #aee7ff;
}

.sales-template-card button:hover,
.sales-template-card button:focus-visible {
  outline: none;
  border-color: #ffc067;
  background: linear-gradient(135deg, #ff8a1d, #ff4f8b);
  color: #fff;
}

@media (max-width: 980px) {
  .sales-studio-main {
    padding: 20px 18px 0;
  }

  .sales-template-tabs {
    grid-template-columns: 1fr;
  }

  .sales-template-heading {
    align-items: start;
    flex-direction: column;
  }

  .sales-template-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  body.sales-builder-page .hub-layout {
    display: block;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body.sales-builder-page .hub-layout > .shared-global-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: -258px !important;
    width: 248px !important;
    min-width: 248px !important;
    height: 100vh !important;
    margin-top: 0 !important;
    z-index: 95;
    flex: 0 0 auto !important;
    transition: left 0.25s ease;
  }

  body.sales-builder-page .hub-layout > .shared-global-sidebar.open {
    left: 0 !important;
  }

  body.sales-builder-page .sales-studio-main {
    width: 100%;
    max-width: 100vw;
  }
}

@media (min-width: 981px) and (max-width: 1320px) {
  .sales-template-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .sales-studio-main {
    padding: 12px 8px 0;
  }

  .sales-template-page {
    gap: 12px;
  }

  .sales-template-tabs {
    top: var(--topbar-height);
    gap: 10px;
    padding: 10px;
    border-radius: 11px;
  }

  .sales-template-tabs-title strong {
    font-size: 13px;
  }

  .sales-template-tab-list {
    gap: 6px;
  }

  .sales-template-tab {
    min-height: 32px;
    padding: 0 10px;
    font-size: 10.5px;
  }

  .sales-template-stage {
    gap: 12px;
    padding: 10px;
    border-radius: 13px;
  }

  .sales-template-heading {
    gap: 8px;
  }

  .sales-template-heading h1 {
    font-size: 22px;
  }

  .sales-template-heading p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11.5px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .sales-template-heading > strong {
    padding: 6px 9px;
    font-size: 10.5px;
  }

  .sales-template-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sales-template-card {
    gap: 8px;
    padding: 7px;
    border-radius: 11px;
  }

  .sales-template-preview {
    border-radius: 8px;
  }

  .sales-template-preview::after {
    right: 6px;
    bottom: 6px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .sales-template-preview.google-preview span {
    inset: auto auto 8px 8px;
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .sales-template-card-copy {
    gap: 3px;
  }

  .sales-template-card-copy span {
    font-size: 8.5px;
    letter-spacing: 0.08em;
  }

  .sales-template-card-copy h2 {
    overflow: hidden;
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sales-template-card-copy p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .sales-template-actions {
    gap: 5px;
  }

  .sales-template-card button {
    min-height: 31px;
    padding: 0 4px;
    border-radius: 7px;
    font-size: 9.5px;
    line-height: 1.25;
  }
}

@media (max-width: 1180px) {
  body.sales-builder-page .shared-global-sidebar:not(.open) {
    left: -258px !important;
  }

  body.sales-builder-page .shared-global-sidebar.open {
    left: 0 !important;
  }
}
