.smp-panel {
  position: fixed;
  z-index: 100010;
  width: min(340px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 24px));
  height: auto;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #141617;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font-family: var(--font-main);
}

.smp-panel.open {
  display: flex;
  animation: smp-in 0.16s ease-out;
}

@keyframes smp-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.smp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 12px 4px;
  padding: 0 12px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.smp-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #8e8e93;
}

.smp-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f5f5f7;
  font-size: 13.5px;
}

.smp-search input::placeholder {
  color: #6e6e73;
}

.smp-body {
  display: flex;
  min-height: 0;
  flex: 1;
  margin: 4px 6px 8px;
}

.smp-families {
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 8px;
  width: 100%;
  max-height: min(460px, calc(100vh - 132px));
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.smp-families::-webkit-scrollbar,
.smp-flyout-list::-webkit-scrollbar {
  width: 8px;
}

.smp-families::-webkit-scrollbar-thumb,
.smp-flyout-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.smp-section {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 10px 8px;
  color: #9a9aa3;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.smp-section svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  opacity: 0.8;
}

.smp-family,
.smp-model {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  touch-action: manipulation;
}

.smp-family,
.smp-model {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 14px;
  margin-bottom: 1px;
}

.smp-family:hover,
.smp-family.hover,
.smp-model:hover {
  background: rgba(255, 255, 255, 0.055);
}

.smp-family.active,
.smp-model.active {
  background: rgba(255, 255, 255, 0.08);
}

.smp-family-logo,
.smp-model-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
  padding: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex: 0 0 auto;
  box-sizing: border-box;
}

.smp-trigger .ai-model-logo,
.s5-model-left .ai-model-logo {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1a1c;
  flex: 0 0 auto;
}

.smp-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #c7c7cc;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  letter-spacing: 0;
  filter: none;
}

.smp-row-copy,
.smp-family-copy,
.smp-model-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.smp-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.smp-row-name,
.smp-family-name,
.smp-model-name {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: #f4f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smp-row-meta {
  font-size: 11.5px;
  line-height: 1.3;
  color: #8a8a93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smp-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
}

.smp-tag.is-unlimited {
  background: linear-gradient(90deg, #7ad7ff 0%, #8f86ff 100%);
  color: #101014;
}

.smp-tag.is-new {
  background: #d8ff4a;
  color: #14140a;
}

.smp-tag.is-badge,
.smp-tag.is-local {
  background: rgba(255, 255, 255, 0.1);
  color: #d8d8de;
}

.smp-family-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: #6e6e73;
  opacity: 0.7;
}

.smp-family.hover .smp-family-caret,
.smp-family:hover .smp-family-caret {
  color: #c7c7cc;
  opacity: 1;
}

.smp-credits {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(243, 212, 138, 0.12);
  color: #ead08a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.smp-upgrade {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #b7b7be;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.smp-lock {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  opacity: 0.8;
}

.smp-empty {
  padding: 28px 12px;
  text-align: center;
  color: #8e8e93;
  font-size: 13px;
}

.smp-flyout {
  position: fixed;
  z-index: 100011;
  width: min(340px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - 24px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #141617;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font-family: var(--font-main);
}

.smp-flyout.open {
  display: flex;
  animation: smp-flyout-in 0.16s ease-out;
}

@keyframes smp-flyout-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.smp-flyout.opens-left.open {
  animation-name: smp-flyout-in-left;
}

@keyframes smp-flyout-in-left {
  from { opacity: 0; transform: translateX(6px); }
  to { opacity: 1; transform: translateX(0); }
}

.smp-flyout-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px 6px;
  font-size: 12px;
  font-weight: 650;
  color: #9a9aa3;
}

.smp-flyout-list {
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 10px;
}

.smp-trigger {
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.smp-trigger > .smp-logo-fallback,
.smp-trigger > img.ai-model-logo {
  display: none !important;
}

.smp-trigger .smp-trigger-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smp-trigger-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.smp-trigger-icon .ai-model-logo,
.smp-trigger-icon .smp-logo-fallback {
  width: 18px;
  height: 18px;
}
.smp-logo-fallback[hidden],
img.ai-model-logo[hidden] {
  display: none !important;
}

.s5-model-selector.smp-trigger {
  max-width: none;
  display: flex;
}

#ai-model-btn.smp-trigger {
  max-width: none;
}

#s2-chatBar .s2-bottom-toolbar {
  justify-content: center;
  align-items: center;
}

#s2-chatBar .s2-bottom-toolbar .chat-input-wrapper {
  width: 100%;
}

#s2-text-model-trigger {
  max-width: 150px;
  height: 32px;
  padding: 0 10px;
  margin: 0;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d0d0d4;
  font-size: 12px;
}

#s2-text-model-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.is-plan-locked {
  opacity: 0.42 !important;
  cursor: not-allowed !important;
}

.smp-upgrade-modal {
  position: fixed;
  inset: 0;
  z-index: 100020;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(8, 9, 10, 0.72);
  backdrop-filter: blur(10px);
}

.smp-upgrade-modal.open {
  display: flex;
}

.smp-upgrade-dialog {
  position: relative;
  width: min(880px, 100%);
  max-height: min(88vh, 780px);
  overflow: auto;
  padding: 28px 24px 22px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #141617;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  color: #f3f3f5;
  font-family: var(--font-main, inherit);
}

.smp-upgrade-dialog h2 {
  margin: 0 36px 8px 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.smp-upgrade-copy {
  margin: 0 0 18px;
  color: #a7a7af;
  font-size: 14px;
  line-height: 1.5;
}

.smp-upgrade-copy strong {
  color: #f3f3f5;
  font-weight: 620;
}

.smp-upgrade-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b7b7be;
  cursor: pointer;
}

.smp-upgrade-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.smp-upgrade-close svg {
  width: 16px;
  height: 16px;
}

.smp-billing {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.smp-billing button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a7a7af;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.smp-billing button.is-on {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.smp-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.smp-plan {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 2px 0 var(--plan, transparent);
}

.smp-plan.is-popular {
  border-color: rgba(255, 184, 0, 0.35);
}

.smp-plan.is-current {
  background: rgba(255, 255, 255, 0.045);
}

.smp-plan-name {
  font-size: 15px;
  font-weight: 650;
}

.smp-plan-price {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.smp-plan-price s {
  margin-right: 6px;
  color: #8e8e93;
  font-size: 13px;
  font-weight: 500;
}

.smp-plan-price span {
  margin-left: 2px;
  color: #8e8e93;
  font-size: 12px;
  font-weight: 500;
}

.smp-plan-meta {
  color: #a7a7af;
  font-size: 12px;
  line-height: 1.4;
}

.smp-plan.includes-model .smp-plan-meta {
  color: #d7d7de;
}

.smp-plan ul {
  margin: 0;
  padding: 0 0 0 16px;
  color: #b7b7be;
  font-size: 12px;
  line-height: 1.45;
}

.smp-plan-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #f3f3f5;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.smp-plan-cta.is-primary {
  border-color: transparent;
  background: #f3f3f5;
  color: #141617;
}

.smp-plan-cta.is-current {
  color: #8e8e93;
  cursor: default;
}

.smp-upgrade-empty {
  margin: 0;
  color: #a7a7af;
  font-size: 14px;
}

.smp-upgrade-empty a {
  color: #f3f3f5;
}

@media (max-width: 640px) {
  .smp-panel {
    width: calc(100vw - 16px);
    max-height: min(72vh, 520px);
  }
  .smp-flyout {
    width: min(320px, calc(100vw - 16px));
  }
  .smp-upgrade-dialog {
    padding: 22px 16px 16px;
  }
  .smp-upgrade-dialog h2 {
    font-size: 18px;
  }
}
