/* Presets page (js/presets.js): tabs on top, All presets grid, editor sections with a sticky Save bar. Frosted glass, same tokens as the launch flow. */
.pf-page { --pf-line: color-mix(in srgb, var(--tx) 9%, transparent); --pf-fill: color-mix(in srgb, var(--tx) 4%, transparent); gap: 14px; padding-bottom: 28px; min-width: 0; }
.pf-page .sp { flex: 1; }
.pf-page i { font-style: normal; }

/* One screen: the page fills the window (js/presets.js sets --pf-h), only the content area scrolls */
.pf-page { display: flex; flex-direction: column; height: var(--pf-h, calc(100vh - 110px)); padding-bottom: 0; overflow: visible; }
.pf-page > .ph { flex: none; margin: 0; align-items: center; }
.pf-page > .ph .ph-act { flex: none; }
.pf-page > .ph > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 14px; min-width: 0; }
.pf-page > .ph h1 { margin: 0; }
.pf-page > .ph p { margin: 0; }
[data-pf-scroll] { min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }

/* ---- the two top choices, then (walkthrough only) the steps ---- */
.pf-top[role="tablist"] { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--box-bg, rgba(20,24,31,.72)); box-shadow: var(--box-sh, inset 0 0 0 1px var(--pf-line)); }
.pf-top[role="tablist"] .pf-t { color: var(--tx2); }
.pf-tabs { flex: none; display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 14px; min-width: 0;
  background: var(--box-bg, rgba(20,24,31,.72)); box-shadow: var(--box-sh, inset 0 0 0 1px var(--pf-line)); }
.pf-t { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 7px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--tx3); font: 500 13px/1.2 var(--f); text-decoration: none; white-space: nowrap; cursor: pointer; transition: color .15s, background .15s; }
.pf-t.done { color: var(--tx2); }
.pf-t:hover { color: var(--tx); background: var(--pf-fill); }
.pf-t.on { color: var(--tx); background: linear-gradient(180deg, color-mix(in srgb, var(--tx) 14%, transparent), color-mix(in srgb, var(--tx) 6%, transparent)); box-shadow: inset 0 0 0 1px var(--pf-line); }
.pf-t:focus-visible { outline: 2px solid var(--ac); outline-offset: 1px; }
.pf-div { flex: none; width: 1px; height: 20px; margin: 0 4px; background: var(--pf-line); }
.pf-t-secs { flex: 1 1 0; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.pf-t-secs .pf-t { flex: 1 1 auto; justify-content: center; }
.pf-t-secs::-webkit-scrollbar { display: none; }

/* ---- All presets ---- */
.pf-all { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.pf-all-top { flex: none; display: flex; align-items: center; gap: 12px; min-width: 0; }
.pf-seg button { display: inline-flex; align-items: center; gap: 6px; }
.pf-seg em { font-style: normal; font-size: 11.5px; color: var(--tx3); font-variant-numeric: tabular-nums; }
.pf-defaults { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; margin: 0; font-size: 12px; color: var(--tx3); min-width: 0; }
.pf-defaults a { color: var(--tx2); text-decoration: none; } .pf-defaults a:hover { color: var(--tx); text-decoration: underline; }
.pf-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 10px; padding: 2px; margin: -2px; }
.pf-empty { grid-column: 1 / -1; align-self: center; justify-self: center; margin-top: 60px; }
.pf-page .pf-card { display: flex; flex-direction: column; gap: 6px; padding: 11px 13px 7px; margin: 0; min-width: 0; }
.pf-c-h { display: flex; align-items: flex-start; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.pf-c-ic { flex: none; display: grid; place-items: center; width: 24px; height: 24px; color: var(--tc, var(--ac)); }
.pf-c-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pf-c-t b { font-size: 14px; font-weight: 600; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-c-t small { font-size: 12px; line-height: 1.3; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-c-h .chip { flex: none; font-style: normal; }
.pf-c-h:hover .pf-c-t b { color: var(--tc, var(--ac)); }
.pf-sets { display: flex; flex-direction: column; margin: 0; flex: 1; }
.pf-sets > div { display: grid; grid-template-columns: 106px minmax(0, 1fr); gap: 8px; align-items: center; padding: 3.5px 0; border-top: 1px solid var(--pf-line); }
.pf-sets dt { display: flex; align-items: center; gap: 6px; color: var(--tx3); font-size: 11.5px; min-width: 0; white-space: nowrap; }
.pf-sets dt .i, .pf-sets dt svg { flex: none; }
.pf-sets dd { margin: 0; font-size: 12px; line-height: 1.35; color: var(--tx); min-width: 0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-sets .off dd { color: var(--tx3); }
.pf-c-f { display: flex; align-items: center; gap: 2px; padding-top: 6px; border-top: 1px solid var(--pf-line); }
.pf-ib { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--tx2); cursor: pointer; transition: color .15s, background .15s; }
.pf-ib:hover { color: var(--tx); background: var(--pf-fill); }

/* ---- editor: one step at a time ---- */
.pf-form { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pf-note { flex: none; margin: 0; display: flex; align-items: center; gap: 6px; }
.pf-sec { flex: 1; min-height: 0; display: flex; flex-direction: column; min-width: 0; animation: pf-in .2s ease-out; }
@keyframes pf-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .pf-sec { animation: none; } }
.pf-sh { flex: none; display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; }
.pf-si { flex: none; display: grid; place-items: center; width: 22px; height: 22px; color: var(--tx2); }
.pf-sh h2 { margin: 0; font: 600 15px/1.3 var(--f); color: var(--tx); }
.pf-sh p { margin: 1px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--tx3); }
.pf-sh .lt-sw { flex: none; }
.pf-page .pf-glass { flex: 0 1 auto; display: flex; flex-direction: column; min-height: 0; padding: 0; margin: 0; overflow: hidden; }   /* the glass stays put, its content scrolls */
.pf-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-width: 0; position: relative; z-index: 1; transition: opacity .18s; }
.pf-bare { flex: 0 1 auto; padding: 2px; margin: -2px; }
.pf-sec.is-off .pf-body { opacity: .42; }
.pf-sec.is-off .pf-body > * { pointer-events: none; }
.pf-body .fl { margin-bottom: 4px; }
.pf-body .tpl-emos { margin-bottom: 2px; }
.pf-body .lr-body { display: flex; flex-direction: column; gap: 12px; padding: 0; min-width: 0; }
.pf-body .lr-grp { margin: 0; padding: 0; border: 0; }
.pf-body .lr-grp h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font: 600 13px/1.3 var(--f); color: var(--tx2); }
.pf-body .lr-grp h4 .i { color: var(--tx3); }
.pf-body .lr-rungs { margin: 0; }
.pf-body .lr-body:not(:first-child) { padding-top: 12px; border-top: 1px solid var(--pf-line); }
.pf-page .pf-body .tt-form { min-width: 0; margin: 0; padding: 0; border: 0; }
.pf-body .tt-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pf-body .hl-panel:not([data-hp="manual"]) .hp-g { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1180px) {   /* same two columns as the launch flow's Volume and Market making pop-ups */
  .pf-page .pf-body .tt-form { display: block; column-count: 2; column-gap: 32px; column-rule: 1px solid color-mix(in srgb, var(--tx) 6%, transparent); }
  .pf-body .tt-form > * { break-inside: avoid; margin-bottom: 10px; }
  .pf-body .tt-form > :last-child { margin-bottom: 0; }
  .pf-body .tt-form > .tt-amt + .tt-time { break-before: column; border-top: 0; padding-top: 0; }
  .pf-body .tt-form :is(.tt-modes button, .tt-dir) small { display: block; white-space: normal; line-height: 1.3; }
  .pf-body .tt-form :is(.tt-modes button, .tt-dir) > span { min-width: 0; }
  .pf-body .tt-form :is(.tt-modes button, .tt-dir) { padding-block: 9px; }
  .pf-body .tt-form .tt-dir { flex-direction: column; align-items: flex-start; gap: 5px; min-height: 0; padding-inline: 12px; }
  .pf-body .tt-form .tt-dir > svg { display: block; flex: none; width: 44px; height: 16px; }
}
.pf-fees.pf-fitv { display: block; }
.pf-fees.pf-fitv > .fee-to { margin: 0; }

/* Where it trades: the Token & Venue steps, one column */
.pf-page .pf-fitv.split.fitv { display: block; }
.pf-page .pf-fitv .s1-mid { display: flex; flex-direction: column; gap: 8px; }
.pf-page .pf-fitv .vstep { margin: 0; }
.pf-page .pf-fitv .s1-mid > .vstep:last-child { flex: none; }
.pf-pool { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--pf-line); }
.pf-pool .field { min-width: 0; margin: 0; }
.pf-pool .seg { width: max-content; max-width: 100%; }
.pf-pool .lr-body { padding: 0; min-width: 0; }
.pf-pool .fh { display: block; margin-top: 4px; font-size: 11.5px; color: var(--tx3); }

/* Review */
.pf-review { flex: 0 1 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 8px; padding: 2px; margin: -2px; }
.pf-review > .pf-rc:first-child { grid-column: 1 / -1; }
.pf-page .pf-rc { display: flex; flex-direction: column; gap: 3px; padding: 8px 8px 10px 12px; margin: 0; min-width: 0; }
.pf-rc header { display: flex; align-items: center; gap: 7px; min-height: 28px; }
.pf-rc header b { font-size: 13px; font-weight: 600; color: var(--tx); }
.pf-rc .lt-sw { flex: none; margin-right: 2px; }
.pf-rc p { margin: 0; padding-right: 8px; font-size: 12.5px; line-height: 1.4; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pf-rc p:first-of-type { color: var(--tx); }
.pf-rc.off p { color: var(--tx3); }

/* action bar, always on screen */
.pf-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-radius: 14px; min-width: 0;
  background: var(--box-bg, rgba(20,24,31,.78)); box-shadow: var(--box-sh, inset 0 0 0 1px var(--pf-line)); }
.pf-bar-ic { flex: none; display: grid; place-items: center; width: 24px; height: 24px; color: var(--tc, var(--ac)); }
.pf-bar-t { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; }
.pf-bar-t b { font-size: 13.5px; font-weight: 600; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-bar-t small { font-size: 11.5px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-bar-t small .dirty { color: var(--ac); }
.pf-bar .btn { flex: none; }
.pf-msg { font-size: 12.5px; color: var(--dn) !important; white-space: nowrap; }
.pf-msg:empty { display: none; }

@media (max-width: 1320px) {
  .pf-t { padding: 7px 8px; font-size: 12.5px; }
  .pf-pool { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-page > .ph p { display: none; }
  .pf-sets > div { grid-template-columns: 88px minmax(0, 1fr); }
  .pf-sets dt .i, .pf-sets dt svg { display: none; }
}
@media (max-width: 760px) { .pf-page { height: auto; } [data-pf-scroll] { overflow: visible; } .pf-tabs { flex-wrap: wrap; } .pf-t-secs { flex-basis: 100%; order: 3; } .pf-grid, .pf-review { grid-template-columns: minmax(0, 1fr); } .pf-bar { flex-wrap: wrap; } }

/* light: pale preset colours stay readable */
html:root[data-theme="light"] :is(.pf-c-ic, .pf-bar-ic) { color: color-mix(in srgb, var(--tc, var(--ac)) 62%, var(--tx)); }
/* Volume: Max trades per wallet opens the right column, so the two columns end about level */
html:root .wpop > .wpop-b > .tt-form > .tt-amt + .tt-cap, .pf-body .tt-form > .tt-amt + .tt-cap { break-before: column; border-top: 0; padding-top: 0; }
html:root .wpop > .wpop-b > .tt-form > .tt-cap + .tt-time, .pf-body .tt-form > .tt-cap + .tt-time { break-before: auto; }
.tt-cap .tt-mm { margin-top: 8px; } .tt-cap .mm-b input::placeholder { color: var(--tx3); }
