/* Desktop shell and product workspace. Mobile keeps its existing navigation. */
.desktop-nav-products,
.desktop-add-label,
.queue-status-filter { display: none; }
.desktop-global-search { display: none; }
.desktop-list-toolbar { display: contents; }
.desktop-filter-tabs { display: none; }
#screen-queue .queue-date-filter-btn { flex: 0 0 auto; white-space: nowrap; }
#screen-queue:has(#cards-container.select-mode) #queue-date-filter-btn { display: none; }

#screen-profile .referral-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid #E7E9F0;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFFFFF 0%, #FCFBFF 100%);
  box-shadow: 0 2px 10px rgba(28, 31, 45, .025);
}
#screen-profile .referral-head-row,
#screen-profile .referral-heading-group { display: flex; align-items: center; min-width: 0; }
#screen-profile .referral-head-row { justify-content: space-between; gap: 12px; }
#screen-profile .referral-heading-group { gap: 11px; }
#screen-profile .referral-heading-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #F0ECFF;
  color: #6346F5;
}
#screen-profile .referral-heading-copy { display: grid; gap: 2px; min-width: 0; }
#screen-profile .referral-heading-copy h2 { margin: 0; color: #14182D; font-size: 15px; font-weight: 750; line-height: 1.3; }
#screen-profile .referral-heading-copy > span { color: #7A8094; font-size: 11.5px; line-height: 1.35; }
#screen-profile .referral-bonus-pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #E7E1FF;
  border-radius: 999px;
  background: #F5F2FF;
  color: #6346F5;
  font-size: 10.5px;
  font-weight: 700;
}
#screen-profile .referral-status {
  margin: -2px 0 0 49px;
  color: #6E7489;
  font-size: 12px;
  line-height: 1.45;
}
#screen-profile .referral-status.is-error { color: #B42318; }
#screen-profile .referral-fields-grid { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(0, 1.5fr); gap: 12px; }
#screen-profile .referral-field { display: grid; gap: 6px; min-width: 0; }
#screen-profile .referral-field-label { color: #4D5266; font-size: 11px; font-weight: 700; }
#screen-profile .profile-share-link-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 4px;
  border: 1px solid #EAECF3;
  border-radius: 12px;
  background: #F8F9FC;
}
#screen-profile .profile-share-link-icon {
  display: inline-flex;
  flex: 0 0 auto;
  margin-inline: 4px;
  color: #858BA3;
}
#screen-profile .profile-share-link-input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 34px;
  padding: 0 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #363B52;
  font: 600 11.5px/1.3 var(--font-family);
}
#screen-profile .profile-share-copy-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #DDD6FF;
  border-radius: 9px;
  background: #EEEAFE;
  color: #5637E8;
  font: 750 10px/1 var(--font-family);
  cursor: pointer;
  transition: background-color .16s ease, transform .16s ease;
}
#screen-profile .profile-share-copy-button:hover { border-color: #C9BEFF; background: #E6E0FF; }
#screen-profile .profile-share-copy-button:active { transform: scale(.98); }
#screen-profile .affiliate-card #affiliate-dashboard { width: 100%; min-width: 0; }

/* Keep account tools directly above the legal section, after referral/role cards. */
#screen-profile .profile-bento-role-column { order: 1; }
#screen-profile .profile-settings-section,
#screen-profile .profile-integrations-section { order: 2; }
#screen-profile .profile-settings-other-items { display: contents; }

@media (max-width: 700px) {
  #screen-profile .referral-card { gap: 10px; padding: 14px; }
  #screen-profile .referral-fields-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #screen-profile .referral-status { margin: 0; }
  #screen-profile .referral-heading-icon { width: 34px; height: 34px; flex-basis: 34px; }
  #screen-profile .referral-bonus-pill { padding: 5px 8px; font-size: 10px; }
  #screen-profile .profile-share-link-input { font-size: 11px; }
  #screen-queue .queue-date-filter-label { display: none; }
  #screen-queue .queue-date-filter-btn .filter-btn-tag { margin-left: 0; padding: 2px 5px; font-size: 10px; }
}

.queue-empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  background: transparent;
  color: #6346F5;
}
.queue-empty-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 24px;
  padding: 0 16px;
  border: 1px solid #6346F5;
  border-radius: 8px;
  background: #6346F5;
  color: #fff;
  font: 500 14px/1.4 var(--font-family);
  cursor: pointer;
  transition: background 200ms ease;
}
.queue-empty-add > span { font-size: 22px; font-weight: 400; }
.queue-empty-add:hover { background: #5438DE; }
.queue-empty-add:disabled { opacity: .55; cursor: wait; }
.queue-empty-add:focus-visible { outline: 2px solid #6346F5; outline-offset: 4px; }

#bottom-bar-main .nav-account-submenu { display: none; }

@media (min-width: 1024px) {
  :root {
    --font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bg: #FAFAFF;
    --text: #14182D;
    --hint: #858BA3;
    --border: #E9EAF3;
    --primary: #6346F5;
    --primary-soft: #F1EEFF;
  }
  body { background: var(--bg); }
  .mobile-install-guide[data-desktop] .mobile-install-guide-card { border-radius: 12px; box-shadow: none; }
  .mobile-install-guide[data-desktop] #install-guide-now { width: 100%; min-height: 40px; margin-top: 16px; font-size: 14px; box-shadow: none; }

  /* The active main section is already identified in the persistent sidebar. */
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile) > .q-header .q-title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile) > .q-header .q-subtitle {
    display: none;
  }

  #bottom-bar-main {
    width: 240px;
    max-width: 240px;
    padding: 0 16px 24px;
    border-right: 1px solid var(--border);
    background: #fff;
    overflow-y: auto;
  }
  #bottom-bar-main .desktop-sidebar-brand {
    flex: 0 0 72px;
    min-height: 72px;
    gap: 8px;
    padding: 0 8px;
    font-size: 21px;
    font-weight: 700;
  }
  #bottom-bar-main .desktop-sidebar-brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    box-shadow: none;
  }
  #bottom-bar-main .tab-nav { gap: 8px; margin: 32px 0 24px; }
  #bottom-bar-main .nav-tab {
    height: 42px;
    padding: 0 16px;
    border-radius: 8px;
    color: var(--hint);
    transition: color 200ms ease, background 200ms ease;
  }
  #bottom-bar-main .nav-tab:hover { background: #F7F7FC; color: var(--text); }
  #bottom-bar-main .nav-tab.active { padding: 0 16px; background: #F1EEFF; color: #6346F5; }
  #bottom-bar-main .nav-tab:active { transform: none; }
  #bottom-bar-main .nav-tab-icon-wrap,
  #bottom-bar-main .nav-tab-icon { width: 19px; height: 19px; }
  #bottom-bar-main .nav-tab .nav-tab-label {
    margin-left: 16px;
    font-size: 14px;
    font-weight: 500;
    color: inherit;
  }
  .mobile-nav-home { display: none; }
  .desktop-nav-products { display: inline; }
  #bottom-bar-main .nav-tab-badge { font-size: 9px; box-shadow: none; }
  #bottom-bar-main .desktop-install-badge {
    min-height: 40px;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--hint);
    box-shadow: none;
  }
  #bottom-bar-main .desktop-install-badge:hover { background: #F7F7FC; transform: none; box-shadow: none; }
  .desktop-install-icon { width: 24px; height: 24px; background: none; color: inherit; box-shadow: none; }
  .desktop-install-copy strong { font-weight: 500; }
  .desktop-install-copy small { display: none; }

  /* Profile desktop layout is handled in the dedicated profile block below. */

  #app-top-header {
    display: flex;
    left: 240px;
    width: calc(100% - 240px);
    max-width: none;
    height: 72px;
    margin: 0;
    padding: 0 40px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #app-top-header .app-top-actions {
    justify-content: flex-end;
    gap: 16px;
    width: auto;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }
  #credits-floating-pill {
    flex: none;
    min-height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--hint);
    font-size: 12px;
    font-weight: 500;
  }
  #app-top-notifications,
  #app-top-avatar { width: 32px; height: 32px; flex-basis: 32px; box-shadow: none; color: var(--hint); }
  #app-top-avatar { background: #F1EEFF; color: var(--primary); font-size: 12px; }
  #app-top-notifications:hover { background: #F7F7FC; }
  #notifications-panel {
    top: calc(100% + 20px);
    right: 0;
    bottom: auto;
    left: auto;
    width: 352px;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: none;
  }
  .screen,
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile, #screen-channels, #screen-scene, #screen-details, #screen-text) {
    width: calc(100% - 240px);
    max-width: none;
    margin: 72px 0 0 240px;
    padding: 32px 40px;
  }
  .screen.active,
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile, #screen-channels, #screen-scene, #screen-details, #screen-text).active {
    height: calc(100dvh - 72px);
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }
  #screen-queue.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 280px) auto;
    grid-template-rows: auto auto auto auto auto 1fr;
    align-content: start;
    column-gap: 16px;
  }
  #screen-queue::before {
    content: '';
    grid-column: 1 / -1;
    grid-row: 4;
    height: 1px;
    margin-top: -1px;
    background: var(--border);
    pointer-events: none;
  }
  #screen-queue > .q-header,
  #screen-queue > .queue-promo-banner,
  #screen-queue > .sel-bar,
  #screen-queue > .queue-skeleton,
  #screen-queue > .cards-wrap,
  #screen-queue > .empty-state { grid-column: 1 / -1; min-width: 0; }
  #screen-queue .q-header {
    grid-row: 1;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 32px;
    padding: 0;
    background: transparent;
  }
  #screen-queue > .queue-promo-banner {
    grid-row: 2;
    grid-column: 1 / -1;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 24px;
  }
  #screen-queue > .queue-promo-banner[hidden] {
    display: none !important;
    margin: 0 !important;
  }
  #screen-queue > .queue-promo-banner.is-dismissing {
    opacity: 0;
    max-height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none;
  }
  #screen-queue .q-heading { width: auto; min-width: 0; text-align: left; }
  #screen-queue .queue-heading-icon { display: none; }
  #screen-queue .q-header .q-title { font-size: 30px; font-weight: 600; line-height: 1.2; letter-spacing: -.9px; }
  #screen-queue .q-header .q-subtitle { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--hint); }
  #screen-queue .nav-add-product-slot { flex: 0 0 auto; width: auto; }
  #screen-queue #add-product-btn {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    height: 40px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
    transform: none;
    transition: background 200ms ease;
  }
  #screen-queue #add-product-btn:hover { background: #5438DE; }
  #screen-queue #add-product-btn::before { content: '+'; font-size: 22px; font-weight: 400; }
  #screen-queue #add-product-btn .add-product-icon,
  #screen-queue #add-product-btn .add-product-label { display: none; }
  #screen-queue #add-product-btn .desktop-add-label { display: inline; }
  #screen-queue #add-product-btn.is-loading::before,
  #screen-queue #add-product-btn.is-loading .desktop-add-label { display: none; }
  #screen-queue #add-product-btn.is-loading .add-product-label { display: inline; }

  #screen-queue .tab-area {
    grid-column: 1;
    grid-row: 3;
    align-self: stretch;
    min-width: 0;
    margin: 0;
    padding: 0;
  }
  #screen-queue .tabs-scroll { height: 56px; gap: 24px; padding: 0; }
  #screen-queue .tab-pill {
    height: 56px;
    gap: 8px;
    padding: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--hint);
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
    transition: color 200ms ease, border-color 200ms ease;
  }
  #screen-queue .tab-pill:hover:not(.active) { background: transparent; color: var(--text); }
  #screen-queue .tab-pill.active { border-color: var(--primary); background: transparent; color: var(--primary); box-shadow: none; }
  #screen-queue .tab-icon,
  #screen-queue .tab-dot { display: none; }
  #screen-queue .tab-badge,
  #screen-queue .tab-pill:not(.active) .tab-badge { min-width: 0; padding: 0; background: none; color: inherit; font-size: 12px; font-weight: 400; }
  #screen-queue .sticky-zone {
    grid-column: 2;
    grid-row: 3;
    position: static !important;
    display: block;
    align-self: start;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #screen-queue .search-wrap { min-width: 0; height: 40px; margin: 0; padding: 0; }
  #screen-queue .search-input {
    width: calc(100% - 48px);
    height: 40px;
    padding: 0 32px 0 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    color: var(--text);
    font-size: 13px;
    transition: border-color 200ms ease;
  }
  #screen-queue .search-input::placeholder { color: var(--hint); }
  #screen-queue .search-input:focus { border-color: var(--primary); box-shadow: none; }
  #screen-queue .search-icon { left: 12px; width: 18px; height: 18px; color: var(--hint); }
  #screen-queue .search-icon svg { width: 18px; height: 18px; }
  #screen-queue .search-clear { right: 52px; width: 24px; height: 24px; }
  .queue-status-filter {
    position: absolute;
    inset: 0 0 auto auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--hint);
  }
  .queue-status-filter svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; pointer-events: none; }
  .queue-status-filter select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .queue-status-filter.has-filter { background: var(--primary-soft); color: var(--primary); border-color: #DAD2FF; }
  .queue-status-filter:focus-within { outline: 2px solid var(--primary); outline-offset: 3px; }
  #screen-queue .product-toolbar {
    grid-column: 3;
    grid-row: 3;
    align-self: start;
    justify-content: flex-end;
    gap: 16px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
  }
  #screen-queue .product-count { max-width: 120px; color: var(--hint); font-size: 13px; font-weight: 400; }
  #screen-queue .select-toggle-new {
    min-height: 32px;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
  }
  #screen-queue .select-toggle-new[aria-pressed='true'] { background: var(--primary-soft); color: var(--primary); border-color: #DAD2FF; }
  #screen-queue .select-toggle-new svg { width: 16px; height: 16px; }
  #screen-queue .sel-bar { grid-row: 5; margin: 0; padding: 8px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  #screen-queue > .cards-wrap,
  #screen-queue > .queue-skeleton {
    grid-row: 6;
  }
  #screen-queue #queue-empty,
  #screen-queue #no-results {
    grid-row: 6;
    align-self: center;
    width: 100%;
    margin: 0;
    padding: 48px 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-queue .es-title { margin: 0; color: var(--text); font-size: 20px; font-weight: 600; line-height: 1.4; letter-spacing: -.4px; }
  #screen-queue .es-sub { max-width: 360px; margin: 8px auto 0; color: var(--hint); font-size: 14px; line-height: 1.6; }
  #cards-container.cards-wrap[style*='display: block'] { gap: 16px; padding: 16px 0 32px; align-content: start; }
  #cards-container .product-card { margin: 0; border-color: var(--border); border-radius: 12px; background: #fff; box-shadow: none; }
  #cards-container .product-card:hover { border-color: #DAD2FF; transform: none; box-shadow: none; }
  #cards-container .product-card.selected { border-color: var(--primary); background: #F8F6FF; }
  #cards-container .card-title { font-size: 15px; font-weight: 600; }
  #cards-container .card-price { font-size: 18px; font-weight: 600; }
  #cards-container .card-inner { border-radius: 12px; }
  #cards-container .card-thumb { border-radius: 8px; }
  #cards-container .card-action-btn:not(.action-regenerate),
  #cards-container .action-regenerate { border-radius: 8px; font-weight: 500; }
  .bottom-bar-multi { left: 240px; bottom: 24px; max-width: 600px; transition: transform 200ms ease, opacity 200ms ease; }
  .multi-bar-inner { padding: 8px; gap: 8px; border-color: var(--border); border-radius: 12px; background: #fff; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .multi-bar-btn { border-radius: 8px; font-weight: 500; }
  body:has(#bottom-bar-multi.visible) #screen-queue { padding-bottom: 104px; }
  #screen-queue :is(button, input):focus-visible,
  #bottom-bar-main :is(button, a):focus-visible,
  #app-top-header button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  #screen-queue.active { grid-template-columns: minmax(0, 1fr) 200px auto; column-gap: 12px; }
  #screen-queue .product-toolbar { gap: 8px; }
  #screen-queue .product-count { max-width: 88px; font-size: 12px; }
  #screen-queue .queue-date-filter-label { display: none; }
  #screen-queue .queue-date-filter-btn .filter-btn-tag { margin-left: 0; padding: 2px 5px; font-size: 10px; }
  #screen-queue .tabs-scroll { gap: 16px; }
  #screen-queue .tab-pill { font-size: 13px; gap: 4px; }
}

@media (min-width: 1024px) {
  :root {
    --desktop-sidebar-width: 186px;
    --bg: #F5F7FB;
    --text: #202332;
    --hint: #666C7B;
    --border: #E5E8F0;
    --primary: #5838E8;
    --primary-soft: #F0ECFF;
    --primary-mid: #E5DEFF;
  }

  body { background: var(--bg); color: var(--text); }

  /* Dark persistent navigation, with a clear lavender active state. */
  #bottom-bar-main {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--desktop-sidebar-width);
    max-width: var(--desktop-sidebar-width);
    height: 100dvh;
    flex-direction: column;
    padding: 16px 14px 20px;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid #292B32;
    background: radial-gradient(ellipse 180px 375px at 0% 100%, rgba(120, 85, 255, .2), rgba(74, 49, 157, .08) 55%, transparent 100%), #17191F;
    color: #F7F7FB;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #bottom-bar-main .desktop-sidebar-brand {
    display: flex;
    flex: 0 0 52px;
    min-height: 52px;
    gap: 10px;
    padding: 0 8px;
    color: #F7F7FB;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.3px;
    text-decoration: none;
  }
  #bottom-bar-main .desktop-sidebar-brand img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: none;
  }
  #bottom-bar-main .tab-nav {
    display: flex;
    flex: 1 0 auto;
    width: 100%;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 28px 0 18px;
  }
  #bottom-bar-main .nav-tab-slot {
    justify-content: flex-start;
    width: 100%;
  }
  #bottom-bar-main .nav-tab {
    justify-content: flex-start;
    width: 100%;
    height: 44px;
    min-width: 0;
    padding: 0 12px;
    border-radius: 10px;
    background: transparent;
    color: #A7A8B2;
    overflow: visible;
    transition: color 180ms ease, background 180ms ease;
  }
  #bottom-bar-main .nav-tab:hover:not(.active) {
    background: #23252C;
    color: #F7F7FB;
  }
  #bottom-bar-main .nav-tab.active {
    padding: 0 12px;
    background: #302751;
    color: #D1C5FF;
    animation: none;
  }
  #bottom-bar-main .nav-tab:active { transform: none; }
  #bottom-bar-main .nav-tab-icon-wrap,
  #bottom-bar-main .nav-tab-icon { width: 19px; height: 19px; }
  #bottom-bar-main .nav-tab .nav-tab-label,
  #bottom-bar-main .nav-tab.active .nav-tab-label,
  #bottom-bar-main .nav-tab:not(.active) .nav-tab-label {
    max-width: none;
    margin-left: 12px;
    opacity: 1;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    transform: none;
    transition: none;
  }
  #bottom-bar-main .nav-tab-badge {
    border: 1px solid #17191F;
    box-shadow: none;
  }
  #bottom-bar-main .nav-add-product-slot {
    display: flex;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    margin: 0 0 14px;
    overflow: visible;
  }
  #bottom-bar-main .nav-add-product-slot #add-product-btn {
    position: static;
    display: inline-flex;
    justify-content: flex-start;
    width: 100%;
    height: 44px;
    min-height: 44px;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid #745BEA;
    border-radius: 10px;
    background: #5838E8;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
    transform: none;
  }
  #bottom-bar-main .nav-add-product-slot #add-product-btn:hover { background: #4628D4; }
  #bottom-bar-main .nav-add-product-slot #add-product-btn::before {
    content: '+';
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
  }
  #bottom-bar-main .nav-add-product-slot #add-product-btn .add-product-icon,
  #bottom-bar-main .nav-add-product-slot #add-product-btn .add-product-label { display: none; }
  #bottom-bar-main .nav-add-product-slot #add-product-btn .desktop-add-label { display: inline; }
  #bottom-bar-main .nav-add-product-slot #add-product-btn.is-loading::before,
  #bottom-bar-main .nav-add-product-slot #add-product-btn.is-loading .desktop-add-label { display: none; }
  #bottom-bar-main .nav-add-product-slot #add-product-btn.is-loading .add-product-label { display: inline; }
  #bottom-bar-main .desktop-install-badge {
    display: flex;
    min-height: 42px;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #A7A8B2;
    box-shadow: none;
  }
  #bottom-bar-main .desktop-install-badge:hover { background: #23252C; transform: none; box-shadow: none; }
  #bottom-bar-main .desktop-install-icon { color: inherit; }
  #bottom-bar-main .desktop-install-copy strong { color: inherit; font-weight: 500; }
  #bottom-bar-main .desktop-install-copy small { display: none; }

  /* Light top bar and one search field bound to the active product section. */
  #app-top-header {
    display: flex;
    position: fixed;
    inset: 0 0 auto var(--desktop-sidebar-width);
    z-index: 1001;
    width: calc(100% - var(--desktop-sidebar-width));
    max-width: none;
    height: 72px;
    align-items: center;
    gap: 24px;
    margin: 0;
    padding: 0 40px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .desktop-global-search {
    display: none;
    position: relative;
    flex: 0 1 360px;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    height: 40px;
    margin: 0 auto 0 0;
    padding: 0 13px;
    border: 1px solid #E6E8F0;
    border-radius: 10px;
    background: #F7F8FC;
    color: #828799;
  }
  .desktop-global-search > svg { flex: 0 0 auto; width: 18px; height: 18px; stroke: currentColor; }
  .desktop-global-search input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: 400 13px/1.4 var(--font-family);
  }
  .desktop-global-search input::placeholder { color: #666C7B; }
  .desktop-global-search:focus-within {
    border-color: #5838E8;
    background: #fff;
    outline: 2px solid #5838E8;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(88, 56, 232, .16);
  }
  body:has(#screen-queue.active) .desktop-global-search,
  body:has(#screen-generated.active) .desktop-global-search,
  body:has(#screen-published.active) .desktop-global-search,
  body:has(#screen-profile.active) .desktop-global-search { display: flex; }
  #app-top-header .app-top-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 14px;
    width: auto;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }
  #credits-floating-pill {
    min-height: 36px;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid #E9E6F5;
    border-radius: 9px;
    background: #FAF9FE;
    color: #51428A;
    font-size: 12px;
    font-weight: 600;
  }
  #credits-floating-pill:hover { border-color: #DCD4FA; background: #F5F2FF; }
  #app-top-notifications,
  #app-top-avatar { width: 36px; height: 36px; flex-basis: 36px; border: 1px solid #E8EAF0; box-shadow: none; }
  #app-top-notifications { background: #fff; color: #697084; }
  #app-top-notifications:hover { background: #F6F7FB; }
  #app-top-avatar { background: #EFEAFF; color: var(--primary); font-size: 13px; }
  #notifications-panel {
    top: calc(100% + 12px);
    right: 0;
    bottom: auto;
    left: auto;
    width: 352px;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(23, 25, 31, .12);
  }

  /* App canvas and card treatment shared by every desktop workspace. */
  .screen,
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile, #screen-channels, #screen-scene, #screen-details, #screen-text) {
    width: calc(100% - var(--desktop-sidebar-width));
    max-width: none;
    margin: 72px 0 0 var(--desktop-sidebar-width);
    padding: 32px 40px 40px;
    color: var(--text);
  }
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile) { padding-top: 16px; }
  .screen.active,
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile, #screen-channels, #screen-scene, #screen-details, #screen-text).active {
    height: calc(100dvh - 72px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile) .q-header {
    min-height: 40px;
    padding: 0 0 24px;
    background: transparent;
  }
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile) .q-header .q-subtitle {
    display: none;
  }
  :is(#screen-generated, #screen-published) .q-header {
    margin: 0 0 24px;
    padding: 0;
  }
  :is(#screen-queue, #screen-generated, #screen-published, #screen-profile) > .q-header {
    min-height: 0;
    height: 0;
    margin: 0;
    padding: 0;
  }
  :is(#screen-generated, #screen-published) .product-toolbar {
    min-height: 40px;
    margin: 0;
    padding: 0;
    padding-top: 0 !important;
    justify-content: flex-end;
    gap: 16px;
  }
  :is(#screen-generated, #screen-published) .product-count { display: none; }
  #screen-generated .product-toolbar { display: none; }
  #screen-published .filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--hint);
  }
  #screen-published .filter-btn > span { display: none; }
  #screen-published .filter-btn.has-filter {
    border-color: #D3C9FF;
    background: #F0ECFF;
    color: var(--primary);
  }
  :is(#cards-container-generated, #cards-container-published).cards-wrap { padding-top: 16px; }
  :is(#screen-generated, #screen-published) .desktop-list-toolbar {
    display: flex;
    align-items: stretch;
    min-height: 56px;
    margin: 0;
    border-bottom: 1px solid var(--border);
  }
  :is(#screen-generated, #screen-published) .desktop-filter-tabs {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    min-width: 0;
    margin: 0;
    padding: 0;
  }
  :is(#screen-generated, #screen-published) .desktop-filter-tabs .tabs-scroll {
    height: 56px;
    gap: 24px;
    padding: 0;
  }
  :is(#screen-generated, #screen-published) .desktop-filter-tabs .tab-pill {
    height: 56px;
    gap: 8px;
    padding: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--hint);
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
    transition: color 200ms ease, border-color 200ms ease;
  }
  :is(#screen-generated, #screen-published) .desktop-filter-tabs .tab-pill:hover:not(.active) {
    background: transparent;
    color: var(--text);
  }
  :is(#screen-generated, #screen-published) .desktop-filter-tabs .tab-pill.active {
    border-bottom-color: var(--primary);
    background: transparent;
    color: var(--primary);
    box-shadow: none;
  }
  :is(#screen-generated, #screen-published) .desktop-filter-tabs .tab-badge,
  :is(#screen-generated, #screen-published) .desktop-filter-tabs .tab-pill:not(.active) .tab-badge {
    min-width: 0;
    padding: 0;
    background: none;
    color: inherit;
    font-size: 12px;
    font-weight: 400;
  }
  :is(#screen-generated, #screen-published) .desktop-list-toolbar .product-toolbar {
    min-height: 56px;
    margin: 0;
    padding: 0;
    padding-top: 0 !important;
    gap: 16px;
    border: 0;
  }
  #screen-generated .desktop-list-toolbar .product-toolbar { display: none; }
  #screen-published .desktop-list-toolbar .product-toolbar { display: flex; }
  .profile-card,
  #screen-profile .profile-preferences,
  #screen-profile .profile-integrations {
    border: 1px solid #E7E9F0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(28, 31, 45, .025);
  }

  /* The queue keeps its status selector in the grid while the search moves up. */
  #screen-queue.active {
    grid-template-columns: minmax(0, 1fr) 44px auto;
    grid-template-rows: auto auto auto auto auto 1fr;
    column-gap: 16px;
  }
  #screen-queue .q-header { margin: 0; }
  #screen-queue .q-header .q-subtitle { margin-top: 0; }
  #screen-queue .tab-area { grid-column: 1; }
  #screen-queue .sticky-zone {
    display: block;
    position: static !important;
    grid-column: 2;
    grid-row: 3;
    width: 40px;
    min-width: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #screen-queue .search-wrap { width: 40px; min-width: 40px; height: 40px; margin: 0; padding: 0; }
  #screen-queue .search-icon,
  #screen-queue .search-input,
  #screen-queue .search-clear { display: none; }
  #screen-generated .sticky-zone,
  #screen-published .sticky-zone { display: none; }
  .queue-status-filter {
    inset: 0;
    width: 40px;
    height: 40px;
    border-color: #E4E6EE;
    border-radius: 9px;
    background: #fff;
    color: #777D8F;
  }
  .queue-status-filter.has-filter { border-color: #D3C9FF; background: #F0ECFF; color: var(--primary); }
  #screen-queue .product-toolbar { grid-column: 3; }
  #screen-queue .tab-pill.active { border-color: var(--primary); color: var(--primary); }
  #screen-queue #add-product-btn { background: var(--primary); border-color: var(--primary); }
  #screen-queue #add-product-btn:hover { background: #4628D4; }
  .queue-empty-icon { background: transparent; color: var(--primary); }
  .queue-empty-add { border-color: var(--primary); background: var(--primary); }
  .queue-empty-add:hover { background: #4628D4; }
  .queue-empty-add:focus-visible { outline-color: var(--primary); }
  #cards-container .product-card,
  #cards-container-generated .generated-card,
  #cards-container-published .product-card {
    border-color: #E5E8F0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 9px rgba(28, 31, 45, .035);
  }
  #cards-container .product-card:hover,
  #cards-container-published .product-card:hover { border-color: #CDC3FB; }
  #cards-container .product-card.selected { border-color: var(--primary); background: #F9F7FF; }
  .bottom-bar-multi { left: var(--desktop-sidebar-width); }

  /* Profile dashboard redesign — desktop overrides */
  #screen-profile .profile-redesign-shell {
    gap: 14px;
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
  }
  #screen-profile .profile-bento-grid {
    gap: 12px;
    align-items: stretch;
  }
  #screen-profile .profile-bento-column { gap: 10px; }
  #screen-profile .profile-bento-top-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 12px;
    min-width: 0;
  }
  #screen-profile .profile-bento-primary,
  #screen-profile .profile-bento-secondary { display: contents; }
  #screen-profile .profile-bento-role-column { grid-column: 1 / -1; grid-row: 2; align-items: stretch; }
  #screen-profile .profile-settings-section { grid-column: 1; grid-row: 3; }
  #screen-profile .profile-integrations-section { grid-column: 2; grid-row: 3; }
  #screen-profile .profile-third-row,
  #screen-profile .profile-bottom-row { display: contents; }
  #screen-profile.active { padding-top: 14px; }
  #screen-profile .profile-page-heading { margin-bottom: 2px; }
  #screen-profile .profile-page-heading .profile-title {
    color: #14182d;
    font-size: 28px;
    font-weight: 750;
    letter-spacing: -.6px;
  }
  #screen-profile .profile-top-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  #screen-profile .profile-user-card,
  #screen-profile .profile-scene-card {
    min-height: 0;
  }
  #screen-profile .profile-user-card {
    align-self: stretch;
    align-items: stretch;
    width: 100%;
    padding: 16px 14px;
    gap: 10px;
    border-radius: 16px;
    background: linear-gradient(145deg, #fff 0%, #fbfaff 100%);
  }
  #screen-profile .profile-avatar {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    font-size: 19px;
  }
  #screen-profile .profile-user-left { gap: 16px; }
  #screen-profile .profile-user-name { font-size: 14px; }
  #screen-profile .profile-user-handle { margin-top: 1px; font-size: 10.5px; }
  #screen-profile .profile-user-stats {
    gap: 10px;
    padding-top: 0;
    border-top: 0;
  }
  #screen-profile .profile-user-stat { gap: 8px; }
  #screen-profile .profile-user-stat-icon {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }
  #screen-profile .profile-user-stat-copy strong { font-size: 14px; }
  #screen-profile .profile-user-stat-copy span { margin-top: 1px; font-size: 10px; }
  #screen-profile .profile-user-stat-divider { height: 28px; }
  #screen-profile .profile-scene-card {
    order: 0;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 40%);
    padding-top: 12px;
    padding-bottom: 12px;
  }
  #screen-profile .profile-scene-content { gap: 8px; }
  #screen-profile .profile-scene-copy h4 { font-size: 19px !important; }
  #screen-profile .profile-scene-copy p {
    margin-top: 3px;
    font-size: 12.5px !important;
    line-height: 1.35;
  }
  #screen-profile .profile-scene-btn { min-height: 34px; padding-inline: 13px; font-size: 12px; }
  #screen-profile .profile-scene-media {
    position: relative;
    aspect-ratio: 2.15 / 1;
    min-height: 0;
    align-self: center;
  }
  #screen-profile .profile-scene-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  #screen-profile .profile-section-heading { font-size: 16px; }
  #screen-profile .profile-settings-section {
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-profile .profile-settings-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  #screen-profile .profile-setting-item {
    flex-direction: row;
    align-items: center;
    min-height: 0;
    padding: 10px 12px;
    border-radius: 14px;
    gap: 10px;
    box-shadow: 0 1px 6px rgba(20, 24, 45, .02);
  }
  #screen-profile .profile-setting-icon {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 0;
    background: transparent;
  }
  #screen-profile .profile-setting-icon.is-neutral {
    background: transparent;
    color: #505569;
  }
  #screen-profile .profile-setting-title { font-size: 15px; }
  #screen-profile .profile-setting-sub { font-size: 12px; }
  #screen-profile .profile-setting-arrow {
    margin-top: 0;
    align-self: center;
  }
  #screen-profile .profile-settings-grid {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0;
    padding: 2px 14px;
    border: 1px solid #e7e9f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(28, 31, 45, .02);
  }
  #screen-profile .profile-setting-item {
    width: 100%;
    flex: 1 1 0;
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid #f0f1f6;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-profile .profile-setting-item:last-child { border-bottom: 0; }
  #screen-profile .profile-setting-item:hover { background: #fbfaff; }
  #screen-profile .affiliate-card { gap: 0; padding: 8px 14px; }
  #screen-profile .affiliate-head-row { min-height: 24px; gap: 6px; }
  #screen-profile .affiliate-title-wrap { gap: 7px; }
  #screen-profile .affiliate-title-wrap h2 { font-size: 14px; }
  #screen-profile .affiliate-active-pill { padding: 2px 7px; font-size: 10px; }
  #screen-profile .affiliate-open-arrow { width: 24px; height: 24px; }
  #screen-profile .affiliate-short-desc { margin: 2px 0 4px; font-size: 11px; }
  #screen-profile .admin-access-card { gap: 8px; padding: 12px 14px; }
  #screen-profile .admin-access-icon { width: 34px; height: 34px; flex-basis: 34px; }
  #screen-profile .admin-crm-btn { min-height: 36px; font-size: 13px; }
  #screen-profile .profile-integrations-section,
  #screen-profile .profile-legal-section { display: grid; gap: 6px; }
  #screen-profile .profile-integrations-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
  }
  #screen-profile .profile-section-heading { font-size: 16px; line-height: 1.25; }
  #screen-profile .profile-integrations {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-height: 0;
    padding: 12px;
    border: 1px solid #e7e9f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(28, 31, 45, .02);
  }
  #screen-profile .profile-integrations > .profile-section-heading {
    color: #73798d;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1.2;
  }
  #screen-profile .profile-integrations-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 auto;
    align-content: stretch;
    width: 100%;
    gap: 2px 8px;
  }
  #screen-profile .profile-integration-card {
    min-height: 44px;
    padding: 6px 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
  }
  #screen-profile .profile-integration-card:nth-child(n) { border: 0; }
  #screen-profile .profile-integration-logo {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  #screen-profile .profile-integration-logo img {
    width: 27px !important;
    height: 27px !important;
  }
  #screen-profile .profile-legal-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 14px;
  }
  #screen-profile .profile-legal-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #screen-profile .profile-legal-item {
    min-height: 38px;
    padding: 4px 10px;
    border-bottom: 0;
    border-right: 1px solid #edf0f5;
    font-size: 12px;
  }
  #screen-profile .profile-legal-item:nth-child(2n) { border-right: 0; }
  #screen-profile .profile-legal-item:nth-child(-n+2) { border-bottom: 1px solid #edf0f5; }
  #screen-profile .profile-legal-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    background: transparent;
  }
  #screen-profile .profile-logout-card { margin-top: 0; }
  #screen-profile .profile-logout-btn { min-height: 40px; padding-inline: 10px; }
  #screen-profile .profile-legal-section { display: block; }
  #screen-profile .profile-legal-card {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
  }
  #screen-profile .profile-legal-card > .profile-section-heading {
    margin: 0;
    color: #596076;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
    white-space: nowrap;
  }
  #screen-profile .profile-legal-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    min-width: 0;
  }
  #screen-profile .profile-legal-item {
    flex: 0 1 auto;
    gap: 6px;
    min-height: 34px;
    padding: 5px 4px;
    border: 0;
    border-radius: 8px;
    font-size: 11.5px;
    white-space: nowrap;
  }
  #screen-profile .profile-legal-item:nth-child(n) { border: 0; }
  #screen-profile .profile-legal-item:hover { background: #f7f6fc; }
  #screen-profile .profile-legal-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
    background: transparent;
  }
  #screen-profile .profile-logout-card {
    width: auto;
    margin: 0;
    justify-self: end;
  }
  #screen-profile .profile-logout-btn {
    width: auto;
    min-width: 158px;
    min-height: 36px;
    padding-inline: 9px;
    font-size: 11.5px;
  }
  #screen-profile .profile-third-row { display: contents; }
  #screen-profile .profile-third-row > :not([hidden]) { align-self: stretch; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) .affiliate-card { grid-column: 2; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) .admin-access-card { grid-column: 1; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):not(:has(.admin-access-card:not([hidden]))):not(:has(.referral-card:not([hidden]))) .affiliate-card { grid-column: 1 / -1; }
  #screen-profile .profile-bento-role-column:has(.admin-access-card:not([hidden])):not(:has(.affiliate-card:not([hidden]))):not(:has(.referral-card:not([hidden]))) .admin-access-card { grid-column: 1 / -1; }
  #screen-profile .profile-bento-role-column:has(.referral-card:not([hidden])):not(:has(.affiliate-card:not([hidden]))):not(:has(.admin-access-card:not([hidden]))) > .referral-card { grid-column: 1 / -1; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])):has(.referral-card:not([hidden])) > .referral-card { grid-column: 1 / -1; }
}

@media (min-width: 1024px) and (max-width: 1180px) {
  #screen-profile .profile-scene-card {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 38%);
  }
  #screen-profile .profile-integrations-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #screen-profile .profile-integrations { padding: 4px; }
  #screen-profile .profile-integration-card { min-height: 44px; padding: 4px 8px; }
}

@media (min-width: 1361px) {
  #screen-profile .profile-integrations-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #screen-profile .profile-integrations { padding: 4px; }
  #screen-profile .profile-integration-card { min-height: 44px; padding: 4px 8px; }
}

@media (min-width: 1024px) and (max-width: 1180px) {
  #screen-profile .profile-legal-card { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  #screen-profile .profile-legal-card > .profile-section-heading { grid-column: 1 / -1; }
  #screen-profile .profile-legal-list { grid-column: 1; flex-wrap: wrap; justify-content: flex-start; }
  #screen-profile .profile-logout-card { grid-column: 2; grid-row: 2; }
}

@media (max-width: 900px) {
  #screen-profile .profile-legal-card { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #screen-profile .profile-legal-card > .profile-section-heading { grid-column: 1; }
  #screen-profile .profile-legal-list { grid-column: 1; flex-wrap: wrap; justify-content: flex-start; }
  #screen-profile .profile-legal-item { flex: 1 1 170px; white-space: normal; }
  #screen-profile .profile-logout-card { grid-column: 1; grid-row: auto; width: 100%; }
  #screen-profile .profile-logout-btn { width: 100%; }
}

@media (min-width: 1024px) and (max-width: 1100px) {
  #screen-profile .profile-bento-role-column { grid-template-columns: minmax(0, 1fr); }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) .affiliate-card,
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) .admin-access-card,
  #screen-profile .profile-bento-role-column > .referral-card { grid-column: 1; }
}

@media (min-width: 1024px) {
  #screen-queue :is(button, input):focus-visible,
  #app-top-header button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
  }
  #bottom-bar-main :is(button, a):focus-visible {
    outline: 2px solid #D1C5FF;
    outline-offset: 2px;
  }
  .queue-empty-add:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .queue-empty-add { transition: none; }
  #screen-queue *, #bottom-bar-main *, #app-top-header * { transition-duration: 0ms !important; }
}

/* Keep the compact no-role profile composition vertically centered. */
@media (min-width: 901px) {
  #screen-profile.active:not(:has(.affiliate-card:not([hidden]))):not(:has(.admin-access-card:not([hidden]))):not(:has(.referral-card:not([hidden]))) {
    padding-block: 14px;
  }
  #screen-profile.active:not(:has(.affiliate-card:not([hidden]))):not(:has(.admin-access-card:not([hidden]))):not(:has(.referral-card:not([hidden]))) .profile-redesign-shell {
    margin-block: auto;
  }
}

/* Keep the profile compact on phones; desktop bento proportions do not scale down. */
@media (max-width: 900px) {
  #screen-profile { padding-inline: 12px; }
  #screen-profile .profile-redesign-shell { gap: 12px; max-width: none; }
  #screen-profile .profile-bento-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #screen-profile .profile-bento-top-row,
  #screen-profile .profile-bento-primary,
  #screen-profile .profile-settings-section,
  #screen-profile .profile-settings-grid { display: contents; }
  #screen-profile .profile-user-card { order: 0; }
  #screen-profile #profile-plan-row { order: 1; }
  #screen-profile .profile-scene-card { order: 2; }
  #screen-profile .profile-settings-other-items { order: 3; }
  #screen-profile .profile-bento-secondary { order: 4; }
  #screen-profile .profile-bento-role-column { order: 5; }
  #screen-profile .profile-bento-grid:has(.affiliate-card:not([hidden])) .profile-bento-role-column,
  #screen-profile .profile-bento-grid:has(.admin-access-card:not([hidden])) .profile-bento-role-column,
  #screen-profile .profile-bento-grid:has(.referral-card:not([hidden])) .profile-bento-role-column {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }
  #screen-profile .profile-third-row > :not([hidden]) { grid-column: 1; align-self: stretch; }

  #screen-profile .profile-card { border-radius: 14px; }
  #screen-profile .profile-user-card {
    min-height: 0;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }
  #screen-profile .profile-user-top { gap: 10px; }
  #screen-profile .profile-user-left { gap: 10px; }
  #screen-profile .profile-avatar { width: 42px; height: 42px; flex-basis: 42px; font-size: 15px; }
  #screen-profile .profile-user-name { font-size: 14px; }
  #screen-profile .profile-user-stats { gap: 8px; padding-top: 0; border-top: 0; }
  #screen-profile .profile-user-stat { gap: 8px; }
  #screen-profile .profile-user-stat-icon { width: 28px; height: 28px; flex-basis: 28px; }
  #screen-profile .profile-user-stat-copy strong { font-size: 13px; }
  #screen-profile .profile-user-stat-copy span { margin-top: 1px; font-size: 10px; }
  #screen-profile .profile-user-stat-divider { height: 24px; }

  #screen-profile .profile-scene-card {
    grid-template-columns: minmax(0, 1fr) 104px;
    grid-template-rows: auto;
    align-items: center;
    gap: 10px;
    min-height: 0;
    padding: 12px;
  }
  #screen-profile .profile-scene-card::after { display: none !important; content: none !important; }
  #screen-profile .profile-scene-content { grid-column: 1; grid-row: 1; justify-content: flex-start; gap: 10px; }
  #screen-profile .profile-scene-copy h4 { font-size: 15px !important; }
  #screen-profile .profile-scene-copy h4::before { display: none; content: none; }
  #screen-profile .profile-scene-copy p { margin-top: 4px; font-size: 10px !important; line-height: 1.35; }
  #screen-profile .profile-scene-btn { min-height: 32px; padding: 5px 8px; gap: 6px; border-radius: 999px; }
  #screen-profile .profile-scene-btn-label { gap: 5px; font-size: 10px; }
  #screen-profile .profile-scene-btn-arrow { width: 18px; height: 18px; flex-basis: 18px; }
  #screen-profile .profile-scene-media { grid-column: 2; grid-row: 1; width: 100%; height: 96px; min-height: 96px; border-radius: 10px; }
  #screen-profile .profile-scene-media img { width: 100%; height: 100%; object-fit: cover; }
  #screen-profile .profile-scene-edit { display: none; }

  #screen-profile .profile-settings-section { gap: 0; }
  #screen-profile #profile-plan-row {
    padding: 9px 12px;
    border: 1px solid #e7e9f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(28, 31, 45, .03);
  }
  #screen-profile .profile-settings-other-items {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 0;
    padding: 2px 12px;
    border: 1px solid #e7e9f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(28, 31, 45, .03);
  }
  #screen-profile .profile-setting-item {
    flex: none;
    min-height: 0;
    padding: 9px 0;
    gap: 9px;
    border: 0;
    border-bottom: 1px solid #f0f1f6;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-profile .profile-setting-item:last-child { border-bottom: 0; }
  #screen-profile .profile-setting-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; }
  #screen-profile .profile-setting-title { font-size: 13px; }
  #screen-profile .profile-setting-sub { margin-top: 2px; font-size: 10.5px; line-height: 1.3; }

  #screen-profile .profile-integrations-section { display: block; }
  #screen-profile .profile-integrations {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 14px;
  }
  #screen-profile .profile-marketplace-coming.profile-integrations { padding: 10px 12px; border-radius: 14px; }
  #screen-profile .profile-integrations > .profile-section-heading { font-size: 12px; line-height: 1.2; }
  #screen-profile .profile-integrations-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; }
  #screen-profile .profile-integration-card { min-height: 42px; gap: 7px; padding: 5px 6px; border-radius: 9px; }
  #screen-profile .profile-integration-logo { width: 25px; height: 25px; flex-basis: 25px; }
  #screen-profile .profile-integration-logo img { width: 22px !important; height: 22px !important; }
  #screen-profile .profile-integration-meta strong { font-size: 10.5px; }
  #screen-profile .profile-integration-meta small { font-size: 9px; }

  #screen-profile .affiliate-card { justify-content: flex-start; gap: 5px; padding: 12px 14px; }
  #screen-profile .affiliate-title-wrap h2 { font-size: 14px; }
  #screen-profile .affiliate-short-desc { margin: 0; font-size: 11px; }
  #screen-profile .admin-access-card { gap: 9px; padding: 12px 14px; }
  #screen-profile .admin-access-top { align-items: center; gap: 10px; }
  #screen-profile .admin-access-icon { width: 32px; height: 32px; flex-basis: 32px; }
  #screen-profile .admin-access-copy h2 { font-size: 14px; }
  #screen-profile .admin-access-copy p { margin-top: 3px; font-size: 10.5px; line-height: 1.35; }
  #screen-profile .admin-crm-btn { min-height: 34px; padding-inline: 12px; font-size: 11px; }

  #screen-profile .profile-legal-card { display: block; padding: 12px; border-radius: 14px; }
  #screen-profile .profile-legal-card > .profile-section-heading { margin: 0 0 6px; font-size: 12px; }
  #screen-profile .profile-legal-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
  #screen-profile .profile-legal-item { flex: none; min-height: 34px; gap: 5px; padding: 4px 2px; border: 0; font-size: 10px; white-space: normal; }
  #screen-profile .profile-legal-icon { width: 20px; height: 20px; flex-basis: 20px; }
  #screen-profile .profile-legal-arrow { width: 12px; flex: 0 0 12px; }
  #screen-profile .profile-logout-card { width: 100%; margin: 6px 0 0; }
  #screen-profile .profile-logout-btn { min-height: 36px; font-size: 11px; }
}

@media (min-width: 1024px) {
  #bottom-bar-main .nav-account-slot {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  #bottom-bar-main .nav-account-submenu:not([hidden]) {
    display: grid;
    gap: 3px;
    margin: 3px 0 4px;
    padding: 2px 0 2px 43px;
  }
  #bottom-bar-main .nav-account-submenu[hidden] { display: none !important; }
  #bottom-bar-main .nav-account-subtab {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #A7A8B2;
    font: 500 12px/1.3 var(--font-family);
    text-align: left;
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease;
  }
  #bottom-bar-main .nav-account-subtab:hover:not(.active) {
    background: #23252C;
    color: #F7F7FB;
  }
  #bottom-bar-main .nav-account-subtab.active {
    background: #23252C;
    color: #D1C5FF;
    font-weight: 650;
  }

  body:has(#screen-plan.active) #app-top-header,
  body:has(#screen-account.active) #app-top-header { display: flex !important; }
  body:has(#screen-plan.active) #bottom-bar-main,
  body:has(#screen-account.active) #bottom-bar-main { display: flex !important; }

  #screen-plan.active,
  #screen-plans.active,
  #screen-account.active {
    position: fixed;
    inset: 72px 0 0 var(--desktop-sidebar-width);
    z-index: 1;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0 !important;
    padding: 28px 40px 40px;
    overflow-x: clip;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }
  #screen-plan .site-header { display: none; }
  #screen-plan .page-shell { width: min(100%, 1280px); max-width: 1280px; padding: 0 0 30px; }
  #screen-plans.active,
  #screen-account.active { background: var(--bg); }
}

/* Shared personal area styling for Account, Plan and Scene. */
#screen-account .account-card,
#screen-account .account-logout-card,
#screen-plan .surface,
#screen-scene .scene-card,
#screen-scene .scene-preview {
  border-color: #E7E9F0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 24, 45, .03);
}
#screen-account .account-eyebrow {
  display: block;
  margin: 0 0 14px;
  line-height: 1.4;
}
#screen-account .account-shell {
  width: min(100%, 1120px);
  max-width: 1120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
#screen-account .account-shell > .account-top-row { margin-bottom: 0; }
#screen-account .account-shell > .account-card,
#screen-account .account-shell > .account-delete-card { margin: 0; }
#screen-account .account-top-row { min-height: 38px; }
#screen-account .account-back-btn,
#screen-account .account-logout-btn { min-height: 36px; }
#screen-account .account-logout-btn {
  padding: 0 12px;
  border: 1px solid #E3E5EE;
  background: #fff;
  color: #6C7285;
}
#screen-account .account-plan-name { margin-top: 5px; font-size: 24px; }
#screen-account .account-plan-description { margin-top: 4px; font-size: 12px; line-height: 1.4; }
#screen-account .account-plan-credit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #F7F8FC;
  color: #6E7489;
  font-size: 11px;
}
#screen-account .account-plan-credit strong { color: #252B45; font-size: 14px; }
#screen-account #account-primary-action { width: auto; min-height: 40px; padding-inline: 16px; border-radius: 11px; font-size: 12px; box-shadow: none; }
#screen-account .account-billing-card {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 24px;
  padding: 20px 22px;
}
#screen-account .account-billing-overview,
#screen-account .account-invoices-overview { min-width: 0; }
#screen-account .account-billing-overview .account-card-heading,
#screen-account .account-invoices-overview .account-card-heading { margin-bottom: 12px; }
#screen-account .account-billing-overview .account-card-icon,
#screen-account .account-invoices-overview .account-card-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 11px; }
#screen-account .account-billing-overview .account-card-heading h2,
#screen-account .account-invoices-overview .account-card-heading h2 { margin: 0; font-size: 15px; }
#screen-account .account-billing-overview .account-billing-row { padding-top: 10px; }
#screen-account .account-billing-overview .account-manage-note { margin: 8px 0 0; font-size: 11px; line-height: 1.4; text-align: left; }
#screen-account #account-billing-action { min-height: 38px; margin-top: 10px; border-radius: 10px; font-size: 11px; box-shadow: none; }
#screen-account .account-invoices-overview { padding-left: 24px; border-left: 1px solid #EEF0F5; }
#screen-account .account-invoice-empty { margin: 0; font-size: 11px; }
#screen-account .account-delete-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(20, 24, 45, .03);
}
#screen-account .account-delete-card p { margin-bottom: 0; }
#screen-account .account-delete-btn { min-height: 38px; padding-inline: 13px; border-radius: 10px; font-size: 11px; }
#screen-scene .scene-preview .scene-back-btn {
  display: inline-flex;
  margin: 0 0 12px;
}
#screen-scene .scene-preview-frame {
  border-radius: 14px;
  box-shadow: none;
}
#screen-account .account-card h2,
#screen-plan .surface h2,
#screen-plans .plan-name,
#screen-scene .scene-card h3 {
  color: #14182D;
}
#screen-account .account-stat { border-radius: 12px; background: #F7F8FC; }
#screen-plan .plan-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(270px, .85fr);
  align-items: stretch;
  gap: 22px;
  margin-bottom: 12px;
  padding: 18px 20px;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(20, 24, 45, .03);
}
#screen-plan .plan-summary,
#screen-plan .credit-summary { min-width: 0; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
#screen-plan .plan-summary .section-topline,
#screen-plan .credit-summary .section-topline { margin-bottom: 10px; }
#screen-plan .plan-summary h2 { margin: 0 0 4px; font-size: 23px; line-height: 1.2; }
#screen-plan .plan-summary .muted-copy { min-height: 0; margin: 0 0 10px; font-size: 12px; line-height: 1.4; }
#screen-plan .plan-summary .offers-link { min-height: 38px; padding-inline: 14px; border-radius: 10px; font-size: 11px; text-decoration: none; }
#screen-plan .credit-summary { padding-left: 22px; border-left: 1px solid #EEF0F5; }
#screen-plan .credit-summary h2 { margin: 0 0 12px; font-size: 27px; }
#screen-plan .credit-meter { height: 7px; }
#screen-plan .credit-stats { margin-top: 7px; }
#screen-plan .renewal-caption { margin-top: 9px; font-size: 10px; }
#screen-plan .billing-summary { margin-bottom: 12px; padding: 17px 20px; border-radius: 16px; }
#screen-plan .billing-summary .section-heading-row { padding-bottom: 11px; }
#screen-plan .billing-details { gap: 14px; padding: 12px 0; }
#screen-plan .billing-action-row .muted-copy { max-width: 700px; line-height: 1.4; }
#screen-plan .legal-section {
  margin-bottom: 12px;
  padding: 14px 18px;
  border: 1px solid #E7E9F0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 24, 45, .03);
}
#screen-plan .withdrawal-section { margin-top: 0; }
#screen-plans .plans-billing-switch { margin-bottom: 12px; }
#screen-plans .plans-top-row { margin-bottom: 12px; }
#screen-plans .plans-grid { gap: 16px; }
#screen-plans .plan-product-photo { border-radius: 12px; }
#screen-scene.active { column-gap: 12px; row-gap: 12px; }
#screen-scene .scene-preview { margin: 0; padding: 12px; border: 1px solid #E7E9F0; }
#screen-scene #scene-form {
  overflow: hidden;
  border: 1px solid #E7E9F0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 24, 45, .03);
}
#screen-scene #scene-form > .scene-card {
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid #EEF0F5;
  border-radius: 0;
  box-shadow: none;
}
#screen-scene .scene-card-header { margin-bottom: 10px; }
#screen-scene .scene-card-header p:not(.sr-only) { display: none; }
#screen-scene .scene-advanced { margin: 14px 16px 10px; }
#screen-scene .scene-credit-note { margin: 0 16px 12px; }
#screen-scene #scene-generate-btn { width: calc(100% - 32px); margin: 0 16px 16px; }
#screen-scene .scene-choice { border-color: #E7E9F0; border-radius: 12px; }
#screen-scene .scene-choice[aria-pressed="true"] { border-color: #6346F5; background: #F1EEFF; }

@media (max-width: 1023px) {
  #screen-scene #scene-form { margin-top: 12px; }
}

@media (min-width: 1024px) {
  #screen-plan .page-shell {
    width: min(100%, 1280px);
    max-width: 1280px;
    margin-inline: auto;
  }
  #screen-plans .plans-shell {
    width: min(100%, 1420px);
    max-width: 1420px;
    margin-inline: auto;
  }
  #screen-account .account-shell {
    width: min(100%, 1120px);
    max-width: 1120px;
    margin-inline: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 10px;
  }
  #screen-account .account-shell > .account-top-row,
  #screen-account .account-shell > .account-delete-card,
  #screen-account .account-shell > .account-billing-card {
    grid-column: 1 / -1;
  }
  #screen-account .account-top-row { margin-bottom: 0; }
  #screen-account .account-billing-card { gap: 20px; }
  #screen-plan .page-shell { padding-top: 0; }
  #screen-plan .withdrawal-section { padding: 18px; }
  #screen-scene.active {
    background: var(--bg);
  }
  #screen-scene .scene-card { padding: 14px 16px; }
}

@media (max-width: 900px) {
  #screen-account .account-card,
  #screen-plan .surface,
  #screen-plans .plan-card,
  #screen-scene .scene-card,
  #screen-account .account-delete-card { border-radius: 14px; }
  #screen-plan .legal-section { padding: 16px 18px; }
  #screen-scene .scene-preview { border-radius: 14px; }
  #screen-scene #scene-form { border-radius: 14px; }
  #screen-scene #scene-form > .scene-card { padding: 13px 15px; }
  #screen-account .account-billing-card { padding: 16px; gap: 16px; }
  #screen-account .account-invoices-overview { padding-left: 16px; }
  #screen-plan .plan-overview { grid-template-columns: minmax(0, 1.1fr) minmax(230px, .9fr); gap: 16px; padding: 16px; }
  #screen-plan .credit-summary { padding-left: 16px; }
}

@media (max-width: 700px) {
  #screen-account .account-billing-card { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #screen-account .account-invoices-overview { padding: 14px 0 0; border-top: 1px solid #EEF0F5; border-left: 0; }
  #screen-account .account-delete-card { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #screen-account .account-delete-btn { justify-self: start; }
  #screen-account #account-primary-action { width: 100%; }
  #screen-plan .plan-overview { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #screen-plan .credit-summary { padding: 14px 0 0; border-top: 1px solid #EEF0F5; border-left: 0; }
}

/* Le immagini sono le card: il resto delle informazioni prosegue sotto la grafica. */
@media (min-width: 1024px) {
  body:has(#screen-plans.active) #app-top-header,
  body:has(#screen-plans.active) #bottom-bar-main { display: none !important; }

  #screen-plans.active {
    position: fixed;
    inset: 0;
    z-index: 1200;
    width: 100%;
    max-width: none;
    height: 100dvh;
    margin: 0 !important;
    padding: calc(24px + var(--safe-t)) 40px calc(32px + var(--safe-b));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    background: radial-gradient(ellipse at 50% 0%, #f0edff 0, #f8f9fc 48%, #f7f8fb 100%);
    box-shadow: none;
  }
  #screen-plans .plans-shell {
    width: min(100%, 1420px);
    max-width: 1420px;
    min-height: 100%;
    margin-inline: auto;
  }
  #screen-plans .plans-top-row { margin-bottom: 18px; }
  #screen-plans .plans-grid { gap: 16px; align-items: start; }
  #screen-plans .plan-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    align-content: start;
    row-gap: 13px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-plans .plan-product-photo {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 3 / 4;
    border-radius: 20px;
  }
  #screen-plans .plan-product-photo img { object-fit: contain; }
  #screen-plans .plan-summary { min-height: 0; }
  #screen-plans .plan-price { margin: 0; font-size: 18px; }
  #screen-plans .plan-price small { font-size: 12px; }
  #screen-plans .plan-annual-note { min-height: 0; margin-top: 2px; }
  #screen-plans .plan-summary { min-height: 90px; }
  #screen-plans .plan-summary-flags { max-width: 48%; }
  #screen-plans .plan-current-tag { flex: 0 0 auto; white-space: nowrap; }
  #screen-plans .plan-choose-btn { grid-column: auto; width: 100%; min-height: 50px; align-self: stretch; padding-inline: 16px; border-radius: 20px; font-size: 14px; }
  #screen-plans .plans-notes { margin-top: 24px; padding: 16px 20px; }
  #screen-plans .plans-contact-note { margin-top: 12px; }
}

@media (min-width: 1280px) {
  #screen-plans .plan-summary { min-height: 0; }
  #screen-plans .plan-summary-flags {
    max-width: none;
    flex-wrap: nowrap;
    align-items: flex-start;
  }
}

@media (min-width: 700px) and (max-width: 1023px) {
  #screen-plans .plan-card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  #screen-plans .plan-product-photo { height: auto; aspect-ratio: 3 / 4; }
}

@media (max-width: 699px) {
  #screen-plans .plan-summary { min-height: 0; }
  #screen-plans .plan-summary-flags { max-width: 42%; }
  #screen-plans .plan-price { font-size: 21px; white-space: nowrap; }
  #screen-plans .plan-price small { font-size: 12px; }
  #screen-plans .plan-choose-btn { border-radius: 20px; }
}

.credit-packs-section {
  margin-top: 48px;
  padding: 28px;
  border: 1px solid #e8e5f8;
  border-radius: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f6ff 58%, #f4fbff 100%);
  box-shadow: 0 14px 42px rgba(43, 39, 91, .07);
}
.credit-packs-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.credit-packs-heading .section-icon { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 14px; }
.credit-packs-heading .eyebrow { margin: 0 0 5px; color: #6b58df; font-size: 10px; font-weight: 800; letter-spacing: .09em; }
.credit-packs-heading h2 { margin: 0; color: #20233b; font: 800 clamp(21px, 3vw, 28px)/1.2 Manrope, sans-serif; letter-spacing: -.6px; }
.credit-packs-heading p:last-child { margin: 7px 0 0; color: #777e98; font-size: 13px; line-height: 1.55; }
.credit-packs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.credit-pack-card {
  display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 20px;
  border: 1px solid #e4e3f1; border-radius: 18px; background: rgba(255,255,255,.88);
  box-shadow: 0 7px 20px rgba(34, 36, 72, .045);
}
.credit-pack-card.is-featured { border-color: #cfc5ff; background: linear-gradient(145deg, #f6f3ff, #fff 72%); box-shadow: 0 10px 28px rgba(101, 83, 232, .12); }
.credit-pack-name { color: #737990; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.credit-pack-credits { margin-top: 8px; color: #242640; font: 800 26px/1.2 Manrope, sans-serif; letter-spacing: -.8px; }
.credit-pack-price { margin-top: 5px; color: #5d4bdb; font: 800 22px/1.2 Manrope, sans-serif; }
.credit-pack-unit { margin-top: 4px; color: #8c91a5; font-size: 11px; }
.credit-pack-buy { width: 100%; min-height: 44px; margin-top: 18px; border: 0; border-radius: 13px; background: #6553e8; color: #fff; font-family: inherit; font-size: 12px; font-weight: 750; cursor: pointer; box-shadow: 0 5px 14px rgba(101,83,232,.2); }
.credit-pack-buy:hover:not(:disabled) { background: #5645db; }
.credit-pack-buy:disabled { cursor: not-allowed; opacity: .52; box-shadow: none; }
.credit-packs-note { margin: 15px 0 0; color: #898ea2; font-size: 10.5px; line-height: 1.5; }

@media (max-width: 760px) {
  .credit-packs-section { margin-top: 30px; padding: 20px 16px; border-radius: 20px; }
  .credit-packs-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .credit-pack-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 15px; }
  .credit-pack-name { grid-column: 1; }
  .credit-pack-credits { grid-column: 1; margin-top: 4px; font-size: 22px; }
  .credit-pack-price { grid-column: 2; grid-row: 1 / span 2; margin: 0; text-align: right; }
  .credit-pack-unit { grid-column: 2; grid-row: 3; text-align: right; }
  .credit-pack-buy { grid-column: 1 / -1; margin-top: 11px; }
}

/* Stitch-inspired personal area, keeping the existing account and billing actions. */
#screen-profile.active {
  background: #F8F7FD;
  color: #111827;
}
#screen-profile .profile-redesign-shell {
  width: min(100%, 1120px);
  max-width: none;
  margin-inline: auto;
  gap: 18px;
}
#screen-profile .profile-page-heading {
  display: grid;
  gap: 5px;
  margin: 0;
}
#screen-profile .profile-page-heading .profile-title {
  margin: 0;
  color: #111827;
  font: 750 28px/1.2 Manrope, var(--font-family, sans-serif);
  letter-spacing: -.7px;
}
#screen-profile .profile-page-heading p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}
#screen-profile .profile-bento-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  min-width: 0;
}
#screen-profile .profile-bento-top-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  min-width: 0;
  order: 1;
}
#screen-profile .profile-bento-primary,
#screen-profile .profile-bento-secondary { display: contents; }
#screen-profile .profile-bento-role-column {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  min-width: 0;
  order: 2;
}
#screen-profile .profile-third-row { display: contents; }
#screen-profile .profile-bento-role-column > .admin-access-card { grid-column: 2 !important; }
#screen-profile .profile-settings-section {
  grid-column: 1;
  min-width: 0;
  order: 3;
}
#screen-profile .profile-integrations-section {
  grid-column: 2;
  min-width: 0;
  order: 4;
}
#screen-profile .profile-bottom-row { display: contents; }
#screen-profile .profile-card,
#screen-profile .profile-user-card,
#screen-profile .profile-plan-summary,
#screen-profile .profile-scene-card {
  border: 1px solid #E7E5F0;
  border-radius: 20px;
  background: #FFFFFF;
  box-shadow: 0 4px 14px rgba(45, 38, 91, .045);
}
#screen-profile .profile-card[hidden] { display: none !important; }
#screen-profile .profile-user-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 15px;
  min-width: 0;
  padding: 17px 16px 0;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
#screen-profile .profile-user-card:hover {
  border-color: #D5CCFC;
  box-shadow: 0 7px 20px rgba(91, 63, 255, .09);
}
#screen-profile .profile-user-top,
#screen-profile .profile-user-left { display: flex; align-items: center; min-width: 0; }
#screen-profile .profile-user-top { justify-content: space-between; gap: 12px; }
#screen-profile .profile-user-left { flex: 1; gap: 12px; }
#screen-profile .profile-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 2px solid #EAE5FD;
  background: #F1EEFF;
  color: #5B3FFF;
  font-size: 16px;
  box-shadow: none;
}
#screen-profile .profile-user-info { min-width: 0; }
#screen-profile .profile-user-name {
  overflow: hidden;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#screen-profile .profile-user-handle {
  overflow: hidden;
  margin-top: 2px;
  color: #718096;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#screen-profile .profile-user-manage {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  margin-inline: -2px;
  padding: 0 2px;
  border-top: 1px solid #F0EFF5;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}
#screen-profile .profile-user-manage > svg:first-child { color: #7C879B; }
#screen-profile .profile-user-manage-arrow { margin-left: auto; color: #98A2B3; }
#screen-profile .profile-plan-summary {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 12px;
}
#screen-profile .profile-plan-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}
#screen-profile .profile-plan-tile {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 100px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  text-align: left;
}
#screen-profile .profile-plan-tile.is-plan { background: #FFFBF1; }
#screen-profile .profile-plan-tile.is-credits { background: #F8F6FF; }
#screen-profile .profile-plan-tile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #6046D8;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .045em;
  text-transform: uppercase;
}
#screen-profile .profile-plan-tile.is-plan .profile-plan-tile-heading { color: #B45309; }
#screen-profile .profile-plan-tile-heading svg {
  width: 25px;
  height: 25px;
  padding: 5px;
  border-radius: 8px;
  background: rgba(91, 63, 255, .1);
}
#screen-profile .profile-plan-tile.is-plan .profile-plan-tile-heading svg { background: #FFF0C2; }
#screen-profile .profile-plan-tile > strong,
#screen-profile .profile-plan-credit-value > strong {
  color: #111827;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
}
#screen-profile .profile-plan-active-label { color: #8A5600; font-size: 10px; }
#screen-profile .profile-plan-credit-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
#screen-profile .profile-plan-credit-value > span { color: #667085; font-size: 10px; }
#screen-profile .profile-plan-summary .profile-plan-cta {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 13px;
  background: #F8F9FC;
  color: #172033;
  text-align: left;
  box-shadow: none;
}
#screen-profile .profile-plan-summary[role="button"] {
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
#screen-profile .profile-plan-summary[role="button"]:hover,
#screen-profile .profile-plan-summary[role="button"]:focus-visible {
  border-color: #D5CCFC;
  box-shadow: 0 7px 20px rgba(91, 63, 255, .09);
}
#screen-profile .profile-plan-summary[role="button"]:focus-visible {
  outline: 3px solid rgba(91, 63, 255, .24);
  outline-offset: 2px;
}
#screen-profile .profile-plan-summary[role="button"]:hover .profile-plan-cta,
#screen-profile .profile-plan-summary[role="button"]:focus-visible .profile-plan-cta { background: #F3F0FF; }
#screen-profile .profile-plan-cta-plus { display: grid; place-items: center; flex: 0 0 17px; color: #667085; }
#screen-profile .profile-plan-summary .profile-plan-cta .profile-setting-copy { flex: 1; min-width: 0; }
#screen-profile .profile-plan-summary .profile-plan-cta .profile-setting-title { font-size: 11px; font-weight: 700; line-height: 1.3; }
#screen-profile .profile-plan-summary .profile-plan-cta .profile-setting-arrow { color: #98A2B3; }
#screen-profile .profile-scene-card {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: stretch;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
}
#screen-profile .profile-scene-content { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 18px; min-width: 0; }
#screen-profile .profile-scene-copy h4 { margin: 0; color: #111827; font-size: 18px !important; font-weight: 750; line-height: 1.25; letter-spacing: -.3px; }
#screen-profile .profile-scene-copy p { margin: 7px 0 0; color: #667085; font-size: 12px !important; line-height: 1.5; }
#screen-profile .profile-scene-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 12px;
  background: #111827;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}
#screen-profile .profile-scene-btn:hover { background: #252C3B; transform: translateY(-1px); box-shadow: none; }
#screen-profile .profile-scene-btn-label { display: inline-flex; align-items: center; gap: 7px; font-size: inherit; font-weight: inherit; white-space: nowrap; }
#screen-profile .profile-scene-btn-arrow { display: none; }
#screen-profile .profile-scene-media { position: relative; width: 100%; height: auto; min-height: 180px; border-radius: 16px; overflow: hidden; background: #F3EFE8; }
#screen-profile .profile-scene-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
#screen-profile .profile-scene-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: inherit;
  box-shadow: none;
  cursor: pointer;
}
#screen-profile .profile-scene-photo:focus-visible { outline: 3px solid rgba(91, 63, 255, .7); outline-offset: -3px; }
#screen-profile .profile-scene-photo img { transition: transform .18s ease; }
@media (hover: hover) {
  #screen-profile .profile-scene-photo:hover img { transform: scale(1.025); }
}
#screen-profile .profile-scene-edit { width: 32px; height: 32px; }
#screen-profile .profile-settings-section { display: block; min-width: 0; }
#screen-profile .profile-settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 3px 14px; border: 1px solid #E7E5F0; border-radius: 18px; background: #FFFFFF; box-shadow: 0 4px 14px rgba(45, 38, 91, .045); }
#screen-profile .profile-settings-other-items { display: contents; }
#screen-profile .profile-setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid #F0EFF5;
  border-radius: 0;
  background: transparent;
  color: #111827;
  text-align: left;
  box-shadow: none;
}
#screen-profile .profile-setting-item:last-child { border-bottom: 0; }
#screen-profile .profile-setting-item:hover { background: #FAF9FF; }
#screen-profile .profile-setting-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; background: #F1EEFF; color: #5B3FFF; }
#screen-profile .profile-setting-icon.is-neutral { background: #F1F3F8; color: #64748B; }
#screen-profile .profile-setting-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
#screen-profile .profile-setting-title { color: #111827; font-size: 12px; font-weight: 700; line-height: 1.35; }
#screen-profile .profile-setting-sub { margin-top: 3px; color: #8791A5; font-size: 10.5px; line-height: 1.35; }
#screen-profile .profile-setting-arrow { display: inline-flex; align-items: center; justify-content: center; margin: 0; color: #98A2B3; }
#screen-profile .profile-integrations-section { display: block; min-width: 0; }
#screen-profile .profile-integrations {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 100%;
  padding: 15px;
  border: 1px solid #E7E5F0;
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 4px 14px rgba(45, 38, 91, .045);
}
#screen-profile .profile-integrations > .profile-section-heading { color: #111827; font-size: 13px; font-weight: 750; line-height: 1.3; }
#screen-profile .profile-integrations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#screen-profile .profile-integration-card { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 48px; padding: 7px 8px; border: 1px solid #E7E9F0; border-radius: 12px; background: #FAFBFD; }
#screen-profile .profile-integration-logo { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border: 0; border-radius: 8px; background: #F1F3F8; }
#screen-profile .profile-integration-logo img { width: 24px !important; height: 24px !important; object-fit: contain; }
#screen-profile .profile-integration-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#screen-profile .profile-integration-meta strong { overflow: hidden; color: #293245; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
#screen-profile .profile-integration-meta small { color: #8290A6; font-size: 9px; }
#screen-profile .affiliate-card { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; padding: 16px; border-radius: 18px; }
#screen-profile .affiliate-title-wrap h2 { color: #111827; font-size: 14px; }
#screen-profile .affiliate-active-pill { border-color: #A6F4C5; background: #ECFDF3; color: #027A48; }
#screen-profile .affiliate-short-desc { margin: 0; color: #667085; font-size: 11px; line-height: 1.45; }
#screen-profile .admin-access-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid #5B3FFF;
  border-radius: 18px;
  background: #5B3FFF;
  color: #FFFFFF;
  box-shadow: 0 7px 18px rgba(91, 63, 255, .18);
}
#screen-profile .admin-access-top { display: flex; align-items: center; gap: 11px; }
#screen-profile .admin-access-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; background: rgba(255,255,255,.14); color: #FFFFFF; }
#screen-profile .admin-access-copy h2 { margin: 0; color: #FFFFFF; font-size: 13px; font-weight: 750; }
#screen-profile .admin-access-copy p { margin: 3px 0 0; color: rgba(255,255,255,.82); font-size: 10.5px; line-height: 1.4; }
#screen-profile .admin-crm-btn { display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding: 0 13px; border: 0; border-radius: 12px; background: #FFFFFF; color: #4F35E2; font-size: 11px; font-weight: 750; }
#screen-profile .admin-crm-btn:hover { background: #F1EEFF; }
#screen-profile .profile-legal-card { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 16px; }
#screen-profile .profile-legal-card > .profile-section-heading { margin: 0; color: #667085; font-size: 11px; font-weight: 700; white-space: nowrap; }
#screen-profile .profile-legal-list { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
#screen-profile .profile-legal-item { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 7px; border: 0; border-radius: 8px; color: #667085; font-size: 10.5px; white-space: nowrap; }
#screen-profile .profile-legal-item:hover { background: #F7F6FC; color: #5B3FFF; }
#screen-profile .profile-legal-icon { display: none; }
#screen-profile .profile-legal-arrow { display: none; }
#screen-profile :is(button, a, [role="button"]):focus-visible { outline: 2px solid #5B3FFF; outline-offset: 3px; }

@media (max-width: 900px) {
  #screen-profile.active { padding: 14px 16px calc(92px + var(--safe-b, env(safe-area-inset-bottom, 0px))); }
  #screen-profile .profile-redesign-shell { width: 100%; max-width: 540px; gap: 14px; }
  #screen-profile .profile-page-heading { gap: 4px; margin-bottom: 1px; }
  #screen-profile .profile-page-heading .profile-title { font-size: 23px; letter-spacing: -.55px; }
  #screen-profile .profile-page-heading p { font-size: 11px; }
  #screen-profile .profile-bento-grid { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  #screen-profile .profile-bento-top-row,
  #screen-profile .profile-bento-primary,
  #screen-profile .profile-bento-secondary,
  #screen-profile .profile-bento-role-column,
  #screen-profile .profile-third-row,
  #screen-profile .profile-bottom-row,
  #screen-profile .profile-settings-section,
  #screen-profile .profile-settings-grid { display: contents; }
  #screen-profile .profile-bento-role-column { display: contents !important; }
  #screen-profile .profile-user-card { order: 1; gap: 12px; padding: 14px 14px 0; border-radius: 18px; }
  #screen-profile .profile-avatar { width: 46px; height: 46px; flex-basis: 46px; font-size: 15px; }
  #screen-profile .profile-user-name { font-size: 14px; }
  #screen-profile .profile-user-handle { font-size: 10.5px; }
  #screen-profile .profile-user-manage { min-height: 40px; font-size: 11px; }
  #screen-profile .profile-plan-summary { order: 2; gap: 10px; padding: 12px; border-radius: 18px; }
  #screen-profile .profile-plan-tiles { gap: 9px; }
  #screen-profile .profile-plan-tile { min-height: 96px; gap: 7px; padding: 11px; border-radius: 15px; }
  #screen-profile .profile-plan-tile > strong,
  #screen-profile .profile-plan-credit-value > strong { font-size: 14px; }
  #screen-profile .profile-plan-summary .profile-plan-cta { min-height: 39px; }
  #screen-profile .profile-plan-summary .profile-plan-cta .profile-setting-title { font-size: 10.5px; }
  #screen-profile .profile-scene-card { order: 3; display: flex; flex-direction: column; gap: 12px; padding: 15px; border-radius: 18px; }
  #screen-profile .profile-scene-content { display: contents; }
  #screen-profile .profile-scene-copy { order: 0; }
  #screen-profile .profile-scene-copy h4 { font-size: 15px !important; }
  #screen-profile .profile-scene-copy p { margin-top: 5px; font-size: 11px !important; line-height: 1.4; }
  #screen-profile .profile-scene-media { order: 1; width: 100%; height: 136px; min-height: 136px; border-radius: 14px; }
  #screen-profile .profile-scene-media img { width: 100%; height: 100%; object-fit: cover; }
  #screen-profile .profile-scene-edit { display: none; }
  #screen-profile .profile-scene-btn { order: 2; width: 100%; min-height: 40px; border-radius: 12px; }
  #screen-profile .profile-scene-btn-arrow { display: none; }
  #screen-profile .affiliate-card { order: 4; gap: 9px; padding: 0; border-radius: 0; }
  #screen-profile .referral-card { order: 5; gap: 10px; padding: 0; border-radius: 0; }
  #screen-profile .referral-fields-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #screen-profile .referral-status { margin: 0; }
  #screen-profile .admin-access-card { order: 6; gap: 10px; padding: 14px; border-radius: 18px; }
  #screen-profile #profile-support-row { order: 7; min-height: 58px; padding: 8px 11px; border: 1px solid #E7E5F0; border-radius: 16px; background: #FFFFFF; box-shadow: 0 3px 10px rgba(45, 38, 91, .035); }
  #screen-profile #profile-impostazioni-row { order: 8; min-height: 58px; padding: 8px 11px; border: 1px solid #E7E5F0; border-radius: 16px; background: #FFFFFF; box-shadow: 0 3px 10px rgba(45, 38, 91, .035); }
  #screen-profile .profile-integrations-section { order: 9; }
  #screen-profile .profile-integrations { min-height: 0; gap: 10px; padding: 14px; border-radius: 18px; }
  #screen-profile .profile-integrations > .profile-section-heading { font-size: 12px; }
  #screen-profile .profile-integrations-grid { gap: 7px; }
  #screen-profile .profile-integration-card { min-height: 44px; gap: 6px; padding: 6px; }
  #screen-profile .profile-integration-logo { width: 27px; height: 27px; flex-basis: 27px; }
  #screen-profile .profile-integration-logo img { width: 22px !important; height: 22px !important; }
  #screen-profile .profile-legal-card { display: block; padding: 13px; border-radius: 16px; }
  #screen-profile .profile-legal-card > .profile-section-heading { margin: 0 0 7px; font-size: 11px; }
  #screen-profile .profile-legal-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 8px; }
  #screen-profile .profile-legal-item { min-height: 34px; padding: 5px 3px; font-size: 10px; white-space: normal; }
  #screen-profile .profile-legal-icon { display: none; }
  #screen-profile .profile-legal-arrow { display: none; }
}

@media (max-width: 380px) {
  #screen-profile.active { padding-inline: 14px; }
  #screen-profile .profile-plan-summary { padding: 10px; }
  #screen-profile .profile-plan-tile { padding: 9px; }
  #screen-profile .profile-plan-tile-heading { font-size: 9px; }
  #screen-profile .profile-scene-media { height: 124px; min-height: 124px; }
  #screen-profile .profile-integrations-grid { gap: 6px; }
  #screen-profile .profile-integration-meta strong { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  #screen-profile *, #screen-profile *::before, #screen-profile *::after { transition-duration: 0ms !important; }
}

/* Desktop profile hierarchy: account first, then plan and scene side by side. */
@media (min-width: 901px) {
  #screen-profile .profile-bento-top-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    row-gap: 14px;
  }
  #screen-profile .profile-user-card {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
    gap: 22px;
    min-height: 92px;
    padding: 14px 20px;
  }
  #screen-profile .profile-user-top {
    flex: 1 1 auto;
    min-width: 0;
  }
  #screen-profile .profile-user-manage {
    flex: 0 1 290px;
    min-height: 42px;
    margin: 0;
    padding: 0 0 0 20px;
    border-top: 0;
    border-left: 1px solid #F0EFF5;
  }
  #screen-profile .profile-plan-summary {
    grid-column: 1;
    grid-row: 2;
    align-content: stretch;
    grid-template-rows: 1fr auto;
    padding: 16px;
  }
  #screen-profile .profile-plan-tile { min-height: 112px; }
  #screen-profile .profile-scene-card {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    align-items: stretch;
    gap: 14px;
    min-height: 100%;
    padding: 16px;
  }
  #screen-profile .profile-scene-content { gap: 12px; }
  #screen-profile .profile-scene-copy h4 { font-size: 16px !important; }
  #screen-profile .profile-scene-media { min-height: 176px; }

  #screen-profile .profile-bento-role-column {
    gap: 16px;
    align-items: stretch;
  }
  #screen-profile .profile-settings-section {
    grid-column: 1 / -1;
    min-width: 0;
  }
  #screen-profile .profile-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-profile .profile-settings-other-items { display: contents; }
  #screen-profile #profile-impostazioni-row,
  #screen-profile #profile-support-row {
    min-height: 78px;
    padding: 12px 14px;
    border: 1px solid #E7E5F0;
    border-radius: 16px;
    background: #FFFFFF;
    box-shadow: 0 4px 14px rgba(45, 38, 91, .045);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
  }
  #screen-profile #profile-impostazioni-row:hover,
  #screen-profile #profile-support-row:hover {
    border-color: #D5CCFC;
    box-shadow: 0 7px 18px rgba(91, 63, 255, .08);
    transform: translateY(-1px);
  }

  #screen-profile .profile-bento-role-column .affiliate-card,
  #screen-profile .profile-bento-role-column > .referral-card {
    grid-column: 1;
    min-width: 0;
  }
  #screen-profile .profile-bento-role-column > .admin-access-card { grid-column: 2 !important; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])):not(:has(.referral-card:not([hidden]))) .affiliate-card { grid-column: 1 !important; grid-row: 1; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])):not(:has(.referral-card:not([hidden]))) > .admin-access-card { grid-column: 2 !important; grid-row: 1; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):not(:has(.admin-access-card:not([hidden]))) .affiliate-card { grid-column: 1 !important; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):not(:has(.admin-access-card:not([hidden]))) > .referral-card { grid-column: 2 !important; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):has(.admin-access-card:not([hidden])) .affiliate-card { grid-column: 1 !important; grid-row: 1; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):has(.admin-access-card:not([hidden])) > .admin-access-card { grid-column: 2 !important; grid-row: 1; }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):has(.admin-access-card:not([hidden])) > .referral-card { grid-column: 1 / -1 !important; grid-row: 2; }
  #screen-profile .profile-bento-role-column:not(:has(.referral-card:not([hidden]))):not(:has(.admin-access-card:not([hidden]))) .affiliate-card,
  #screen-profile .profile-bento-role-column:not(:has(.affiliate-card:not([hidden]))):not(:has(.admin-access-card:not([hidden]))) > .referral-card,
  #screen-profile .profile-bento-role-column:not(:has(.affiliate-card:not([hidden]))):not(:has(.referral-card:not([hidden]))) > .admin-access-card {
    grid-column: 1 / -1 !important;
  }

  #screen-profile .profile-bento-role-column .affiliate-card {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 18px;
    border: 1px solid #D7EBDD;
    border-radius: 18px;
    background: linear-gradient(145deg, #FFFFFF 0%, #F6FBF7 100%);
    box-shadow: 0 6px 18px rgba(23, 91, 54, .055);
  }
  #screen-profile .profile-bento-role-column .affiliate-title-wrap h2 { color: #173826; }
  #screen-profile .profile-bento-role-column .affiliate-active-pill { border-color: #B7E7C9; background: #E8F7EE; color: #176B3A; }
  #screen-profile .profile-bento-role-column .affiliate-short-desc { color: #65766B; }

  #screen-profile .profile-bento-role-column > .referral-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid #DDD7FC;
    border-radius: 18px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FBFAFF 58%, #F7F8FF 100%);
    box-shadow: 0 8px 24px rgba(81, 61, 171, .075);
    color: #17152C;
  }
  #screen-profile .profile-bento-role-column > .referral-card::before {
    position: absolute;
    z-index: -1;
    top: -70px;
    right: -42px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(222, 215, 255, .62) 0%, rgba(222, 215, 255, 0) 72%);
    content: "";
    pointer-events: none;
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-heading-icon {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border: 1px solid #E2DCFF;
    border-radius: 14px;
    background: linear-gradient(145deg, #F2EFFF, #E8E2FF);
    color: #5B3FFF;
    box-shadow: 0 4px 10px rgba(91, 63, 255, .1);
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-heading-copy h2 {
    color: #17152C;
    font-size: 16px;
    letter-spacing: -.2px;
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-heading-copy > span {
    color: #70758B;
    font-size: 11px;
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-bonus-pill {
    padding: 7px 11px;
    border-color: #DDD5FF;
    background: #F1EDFF;
    color: #5637E8;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .02em;
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-status {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #E5E1F3;
    border-radius: 12px;
    background: rgba(255, 255, 255, .76);
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-status.is-error {
    border-color: #FECACA;
    background: #FFF7F7;
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-fields-grid {
    gap: 12px;
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-field {
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(230, 227, 243, .9);
    border-radius: 14px;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 2px 8px rgba(38, 32, 82, .025);
  }
  #screen-profile .profile-bento-role-column > .referral-card .referral-field-label {
    color: #686D82;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .055em;
    text-transform: uppercase;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  #screen-profile .profile-bento-role-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  #screen-profile .profile-settings-other-items {
    display: contents;
    order: 7;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #screen-profile #profile-impostazioni-row { order: 7; }
  #screen-profile #profile-support-row { order: 8; }
  #screen-profile .affiliate-card {
    gap: 10px;
    padding: 14px;
    border: 1px solid #D7EBDD;
    border-radius: 16px;
    background: linear-gradient(145deg, #FFFFFF, #F6FBF7);
  }
  #screen-profile .referral-card {
    gap: 12px;
    padding: 14px;
    border: 1px solid #DDD7FC;
    border-radius: 16px;
    background: linear-gradient(135deg, #FFFFFF, #FAF9FF);
  }
}

/* Local-only profile role preview panel, injected only on ?profilePreview=roles. */
#profile-role-debug {
  position: fixed;
  z-index: 1100;
  right: 20px;
  bottom: 20px;
  display: none;
  width: 184px;
  gap: 8px;
  padding: 13px;
  border: 1px solid rgba(215, 219, 233, .95);
  border-radius: 15px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 12px 36px rgba(35, 39, 65, .2);
  color: #232744;
  font: 600 12px/1.25 var(--font-family, Inter, sans-serif);
  backdrop-filter: blur(12px);
}
body:has(#screen-profile.active) #profile-role-debug { display: grid; }
#profile-role-debug .profile-role-debug-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 800;
}
#profile-role-debug .profile-role-debug-heading small {
  color: #767d91;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
#profile-role-debug label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 27px;
  cursor: pointer;
}
#profile-role-debug input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #6554ed;
}

@media (max-width: 900px) {
  #profile-role-debug {
    top: 68px;
    right: 10px;
    bottom: auto;
    width: 164px;
    gap: 5px;
    padding: 10px 11px;
    border-radius: 13px;
    font-size: 11px;
  }
  #profile-role-debug label { min-height: 25px; }
}

/* Affiliates and admin share a row only when both are active. Referral stays on its own row. */
@media (min-width: 901px) {
  #screen-profile .profile-bento-role-column { align-items: start; }
  #screen-profile .profile-bento-role-column .affiliate-card,
  #screen-profile .profile-bento-role-column > .admin-access-card,
  #screen-profile .profile-bento-role-column > .referral-card {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    align-self: start;
  }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) .affiliate-card {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) > .admin-access-card {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) .affiliate-card,
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) > .admin-access-card {
    align-self: stretch;
  }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.admin-access-card:not([hidden])) > .referral-card {
    grid-row: 2 !important;
  }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):not(:has(.admin-access-card:not([hidden]))) .affiliate-card {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
  }
  #screen-profile .profile-bento-role-column:has(.affiliate-card:not([hidden])):has(.referral-card:not([hidden])):not(:has(.admin-access-card:not([hidden]))) > .referral-card {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }
  #screen-profile .profile-bento-role-column:has(.admin-access-card:not([hidden])):not(:has(.affiliate-card:not([hidden]))) > .admin-access-card {
    grid-row: 1 !important;
  }
  #screen-profile .profile-bento-role-column:has(.admin-access-card:not([hidden])):not(:has(.affiliate-card:not([hidden]))):has(.referral-card:not([hidden])) > .referral-card {
    grid-row: 2 !important;
  }
  #screen-profile .profile-bento-role-column .affiliate-card {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }
  #screen-profile .profile-bento-role-column #affiliate-dashboard {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

#screen-profile .referral-fields-grid { grid-template-columns: minmax(0, 1fr); }
#screen-profile .referral-info { position: relative; z-index: 5; flex: 0 0 auto; }
#screen-profile .referral-info > summary {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #DDD6FF;
  border-radius: 50%;
  background: #F4F1FF;
  color: #5B3FFF;
  cursor: pointer;
  list-style: none;
}
#screen-profile .referral-info > summary::-webkit-details-marker { display: none; }
#screen-profile .referral-info > summary:focus-visible { outline: 2px solid #5B3FFF; outline-offset: 2px; }
#screen-profile .referral-info-tooltip {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: min(280px, calc(100vw - 56px));
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #E4DFFF;
  border-radius: 13px;
  background: #FFFFFF;
  box-shadow: 0 10px 28px rgba(47, 39, 91, .16);
  color: #5F657A;
  font-size: 11px;
  line-height: 1.45;
}
#screen-profile .referral-info[open] .referral-info-tooltip,
#screen-profile .referral-info:hover .referral-info-tooltip,
#screen-profile .referral-info:focus-within .referral-info-tooltip { display: grid; }
#screen-profile .referral-info-tooltip p { margin: 0; }
#screen-profile .referral-info-tooltip strong { color: #3F2ACB; font-weight: 800; }
#screen-profile .referral-share-row { width: 100%; min-width: 0; box-sizing: border-box; cursor: pointer; }
#screen-profile .referral-share-row input { cursor: pointer; }
#screen-profile .profile-bento-role-column > .referral-card { overflow: visible; }
#screen-profile .profile-bento-role-column > .referral-card::before {
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
#screen-profile .profile-user-card[data-active-plan] {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}
#screen-profile .profile-user-card[data-active-plan="starter"] {
  border-color: #e6dcfa;
  background-image: linear-gradient(115deg, rgba(255,255,255,.62), rgba(255,255,255,.72)), url('/assets/profile-plans/starter.png');
}
#screen-profile .profile-user-card[data-active-plan="pro"] {
  border-color: #dcd4fb;
  background-image: linear-gradient(115deg, rgba(255,255,255,.62), rgba(255,255,255,.72)), url('/assets/profile-plans/pro.png');
}
#screen-profile .profile-user-card[data-active-plan="business"] {
  border-color: #f1dfbd;
  background-position: 72% center;
  background-image: linear-gradient(115deg, rgba(255,255,255,.76), rgba(255,255,255,.83)), url('/assets/profile-plans/business.png');
}
#screen-profile .profile-plan-tile.is-plan .profile-plan-tile-heading {
  justify-content: space-between;
  text-align: left;
}
#screen-profile .profile-plan-tile.is-plan > strong,
#screen-profile .profile-plan-tile.is-plan .profile-plan-active-label { text-align: left; }
