.fpe-trigger {
  --fpe-tone: var(--ds-gold, #c99635);
  position: relative;
  display: inline-flex;
  min-height: 1.55rem;
  flex: none;
  align-items: center;
  gap: .34rem;
  padding: .18rem .48rem .18rem .56rem;
  border: 1px solid color-mix(in srgb, var(--fpe-tone) 38%, var(--ds-border, rgba(130, 139, 135, .35)));
  border-radius: .52rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--fpe-tone) 11%, var(--ds-surface-raised, #fff)), var(--ds-surface, #fff));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 62%, transparent), 0 2px 7px color-mix(in srgb, var(--fpe-tone) 10%, transparent);
  color: var(--ds-ink-strong, inherit);
  font: inherit;
  font-size: clamp(.52rem, .75cqi, .64rem);
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.fpe-trigger::before {
  content: '';
  width: .76rem;
  height: .76rem;
  flex: none;
  border-radius: .2rem;
  background:
    linear-gradient(135deg, transparent 46%, var(--fpe-tone) 47% 56%, transparent 57%) 15% 18% / 42% 45% no-repeat,
    linear-gradient(45deg, transparent 45%, var(--fpe-tone) 46% 55%, transparent 56%) 52% 34% / 40% 44% no-repeat,
    linear-gradient(135deg, transparent 45%, var(--fpe-tone) 46% 56%, transparent 57%) 78% 9% / 28% 60% no-repeat,
    linear-gradient(var(--fpe-tone), var(--fpe-tone)) 50% 92% / 100% 1px no-repeat;
  opacity: .9;
}

.fpe-trigger:hover {
  border-color: color-mix(in srgb, var(--fpe-tone) 72%, var(--ds-border, transparent));
  background: color-mix(in srgb, var(--fpe-tone) 14%, var(--ds-surface-raised, #fff));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--fpe-tone) 16%, transparent);
  transform: translateY(-1px);
}

.fpe-trigger:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--fpe-tone) 70%, #fff);
  outline-offset: 2px;
}

.fpe-trigger.is-saved {
  --fpe-tone: var(--ds-teal, #169c78);
  border-color: color-mix(in srgb, var(--fpe-tone) 55%, var(--ds-border, transparent));
  background: linear-gradient(145deg, color-mix(in srgb, var(--fpe-tone) 16%, var(--ds-surface-raised, #fff)), color-mix(in srgb, var(--fpe-tone) 7%, var(--ds-surface, #fff)));
}

.fpe-trigger.is-saved::before {
  content: '✓';
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--fpe-tone) 58%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--fpe-tone) 16%, transparent);
  color: var(--fpe-tone);
  font-size: .57rem;
  font-weight: 950;
  line-height: 1;
}

.fpe-trigger.is-temporary {
  --fpe-tone: var(--ds-accent, #3b76b7);
  border-style: dashed;
}

.fpe-trigger.is-temporary::before {
  content: '•';
  display: grid;
  place-items: center;
  background: none;
  color: var(--fpe-tone);
  font-size: 1.15rem;
  line-height: .6;
}

.mw-ticker-cell .fpe-trigger,
.mw-industry-desk .mw-member-head .fpe-trigger {
  min-height: 1.3rem;
  gap: .25rem;
  margin-inline-start: .08rem;
  padding: .1rem .38rem;
  border-color: color-mix(in srgb, var(--fpe-tone) 38%, var(--ds-border));
  border-radius: .38rem;
  background: color-mix(in srgb, var(--fpe-tone) 5%, var(--ds-surface-raised));
  box-shadow: none;
  color: var(--ds-ink-strong);
  font-size: .56rem;
  font-weight: 800;
}

.mw-ticker-cell .fpe-trigger::before,
.mw-industry-desk .mw-member-head .fpe-trigger::before {
  width: .38rem;
  height: .38rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: none;
  color: var(--fpe-tone);
}

.mw-ticker-cell .fpe-trigger.is-saved::before,
.mw-industry-desk .mw-member-head .fpe-trigger.is-saved::before {
  content: '';
  width: .38rem;
  height: .38rem;
  border: 0;
  border-radius: 50%;
  background: var(--fpe-tone);
}

.mw-ticker-cell .fpe-trigger:hover,
.mw-industry-desk .mw-member-head .fpe-trigger:hover {
  background: color-mix(in srgb, var(--fpe-tone) 12%, var(--ds-surface-raised));
  box-shadow: none;
  transform: none;
}

.fx-pe-customize > .fx-pe-active-banner,
.fx-pe-customize > .fx-pe-desk {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

.fx-pe-customize > .fx-pe-active-banner {
  grid-row: 1;
}

.fx-pe-customize > .fx-pe-desk {
  grid-row: 2;
}

.fx-pe-active-banner[hidden] { display: none !important; }

.fx-pe-active-banner {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  margin: 0 0 .75rem;
  padding: .72rem .78rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ds-teal, #1da17b) 38%, var(--ds-border, transparent));
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--ds-teal, #1da17b) 15%, transparent), transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--ds-teal, #1da17b) 8%, var(--ds-surface-raised, #fff)), var(--ds-surface, #fff));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ds-teal, #1da17b) 9%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 42%, transparent);
  color: var(--ds-ink, inherit);
  text-align: right;
  font: inherit;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.fx-pe-active-banner::after {
  content: '';
  position: absolute;
  inset-block: 18%;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--ds-teal, #1da17b);
}

.fx-pe-active-banner:hover {
  border-color: color-mix(in srgb, var(--ds-teal, #1da17b) 62%, var(--ds-border, transparent));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--ds-teal, #1da17b) 14%, transparent);
  transform: translateY(-1px);
}

.fx-pe-active-banner:focus-visible {
  outline: 2px solid var(--ds-teal, #1da17b);
  outline-offset: 3px;
}

.fx-pe-active-banner__mark {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ds-teal, #1da17b) 48%, transparent);
  border-radius: .68rem;
  background: color-mix(in srgb, var(--ds-teal, #1da17b) 14%, transparent);
  color: var(--ds-teal, #1da17b);
  font-weight: 950;
}

.fx-pe-active-banner__copy { min-width: 0; }
.fx-pe-active-banner__copy strong { display: block; color: var(--ds-ink-strong, inherit); font-size: .88rem; }
.fx-pe-active-banner__copy small { display: block; margin-top: .12rem; color: var(--ds-muted, #68736f); font-size: .72rem; line-height: 1.75; }
.fx-pe-active-banner__action { color: var(--ds-teal, #1da17b); font-size: .72rem; font-weight: 900; white-space: nowrap; }
.fx-pe-active-banner__action::after { content: ' ←'; }

.fpe-drawer[hidden] { display: none; }
.fpe-drawer { position: fixed; inset: 0; z-index: 1200; direction: rtl; }
.fpe-drawer__backdrop { position: absolute; inset: 0; border: 0; background: rgba(3,12,16,.58); backdrop-filter: blur(3px); }
.fpe-drawer__panel { position: absolute; inset-block: 0; right: 0; width: min(460px,94vw); display: flex; flex-direction: column; background: linear-gradient(155deg,#10231f,#0b1718 55%,#101b20); color: #f5f3e9; box-shadow: -24px 0 70px rgba(0,0,0,.35); border-left: 1px solid rgba(255,255,255,.1); animation: fpe-in .26s ease-out; }
.fpe-drawer__head { display: flex; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.09); }
.fpe-drawer__head small { color: #d9b96d; }
.fpe-drawer__head h2 { margin: .2rem 0; font-size: 1.12rem; }
.fpe-drawer__head p { margin: 0; color: #9fb6b1; }
.fpe-drawer__head > button { align-self: flex-start; border: 0; background: rgba(255,255,255,.08); color: inherit; border-radius: 50%; width: 2.2rem; height: 2.2rem; font-size: 1.4rem; cursor: pointer; }
.fpe-drawer__body { padding: 1rem 1.25rem; overflow: auto; flex: 1; }
.fpe-drawer__notice { padding: .85rem; border: 1px solid rgba(217,185,109,.25); border-radius: 14px; background: rgba(217,185,109,.07); font-size: .83rem; line-height: 1.8; }
.fpe-drawer__notice p { margin: .25rem 0 0; color: #becbc7; }
.fpe-drawer__loading { padding: 2rem; text-align: center; color: #b8c8c4; }
.fpe-drawer__options { display: grid; gap: .55rem; margin: 1rem 0; }
.fpe-option { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; padding: .7rem; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.035); cursor: pointer; }
.fpe-option:has(input:checked) { border-color: rgba(39,181,139,.55); background: rgba(39,181,139,.1); }
.fpe-option small { grid-column: 2; color: #91a8a3; }
.fpe-option b { direction: ltr; }
.fpe-drawer__manual { display: grid; gap: .35rem; margin-top: 1rem; }
.fpe-drawer__manual small { color: #9db0ac; }
.fpe-drawer__manual input { border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.06); color: #fff; border-radius: 12px; padding: .7rem .8rem; font: inherit; }
.fpe-drawer__result { display: grid; grid-template-columns: repeat(3,1fr); gap: .5rem; margin-top: 1rem; }
.fpe-drawer__result span { padding: .7rem .45rem; text-align: center; border-radius: 12px; background: rgba(255,255,255,.055); }
.fpe-drawer__result small { display: block; color: #9db0ac; }
.fpe-drawer__result b { display: block; margin-top: .25rem; }
.fpe-drawer__state { color: #64d8b5; font-size: .8rem; }
.fpe-drawer__actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: .55rem; padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.09); }
.fpe-action { border: 0; border-radius: 11px; padding: .7rem .6rem; font: inherit; cursor: pointer; }
.fpe-action--apply { background: #d9b96d; color: #17201c; }
.fpe-action--save { background: #27b58b; color: #071a14; }
.fpe-action--reset { background: rgba(255,255,255,.08); color: #f5f3e9; }
.fx-pe-persistence { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: .9rem; border: 1px solid rgba(39,181,139,.22); border-radius: 14px; background: rgba(39,181,139,.055); }
.fx-pe-persistence__copy p { margin: .25rem 0 0; max-width: 740px; font-size: .82rem; line-height: 1.75; }
.fx-pe-persistence__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.is-user-adjusted { box-shadow: inset 3px 0 #27b58b; }
.forward-pe-toast { position: fixed; left: 1rem; bottom: 1rem; z-index: 1500; transform: translateY(140%); opacity: 0; background: #14332b; color: #fff; border: 1px solid #2fc79a; border-radius: 12px; padding: .75rem 1rem; transition: .22s; }
.forward-pe-toast[data-tone=error] { background: #461f27; border-color: #ef6680; }
.forward-pe-toast.is-visible { transform: none; opacity: 1; }

@keyframes fpe-in { from { transform: translateX(100%); } to { transform: none; } }

@media (max-width: 720px) {
  .fx-pe-customize > .fx-pe-active-banner,
  .fx-pe-customize > .fx-pe-desk { grid-column: 1; }
  .fx-pe-customize > .fx-pe-active-banner { grid-row: 2; }
  .fx-pe-customize > .fx-pe-desk { grid-row: 3; }
}

@media (max-width: 640px) {
  .fpe-drawer__panel { width: 100%; top: 8vh; border-radius: 20px 20px 0 0; }
  .fpe-drawer__actions { grid-template-columns: 1fr 1fr; }
  .fpe-action--reset { grid-column: 1/-1; }
  .fx-pe-persistence { align-items: stretch; flex-direction: column; }
  .fx-pe-active-banner { grid-template-columns: auto minmax(0,1fr); gap: .65rem; padding: .68rem; }
  .fx-pe-active-banner__action { grid-column: 2; }
  .mw-ticker-cell .fpe-trigger { padding-inline: .32rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fpe-trigger,
  .fx-pe-active-banner,
  .fpe-drawer__panel { animation: none; transition: none; }
}
