/* v6: compact rows, one aligned workbench. Existing PIP/semantic tokens are unchanged.
   Lists own scrolling; transaction controls never live inside the candidate list. */
:root {
  --workspace-gap: 16px;
  --workspace-height: clamp(640px, calc(100dvh - 264px), 760px);
  --card-inset: 14px;
}
.header, main { max-width: 1360px; margin-inline: auto; }
.header { min-height: 80px; }
main { padding-top: 12px; padding-bottom: 24px; }
.intro { margin-bottom: 12px; }
.intro h1 { font-size: 2.15rem; }
.intro p { margin-top: 9px; }
.flow-steps { margin-block: 20px 14px; gap: var(--workspace-gap); }
.flow-steps small { font-size: .6875rem; }
.workspace { gap: var(--workspace-gap); align-items: stretch; grid-template-columns: minmax(0,1fr) minmax(0,.96fr) minmax(0,1fr); }
.workspace > section { min-width: 0; box-shadow: none; }
.panel-head { padding: 14px var(--card-inset) 10px; min-height: 66px; flex-shrink: 0; }
.panel-sub { margin-top: 3px; }
.panel-head h2, .pick-head h2 { font-size: .9375rem; }
.panel-head > .icon-button { min-width: 34px; min-height: 34px; }

/* Wallet token cards: identity → exact market reading → status/details.
   Native labels keep the entire identity row clickable, not only its checkbox. */
.rich-token { padding: 9px 10px 4px; margin-bottom: 6px !important; border-radius: 10px; }
.rich-choice { min-height: 36px; gap: 8px; }
.rich-token .token-icon { width: 31px; height: 31px; flex: none; }
.rich-token .token-name strong { font-size: .8125rem; line-height: 1.35; }
.rich-token .token-name small { font-size: .6875rem; margin-top: 1px; }
.rich-token .token-value strong { font-size: .8125rem; }
.rich-token .token-value small { margin-top: 2px; font-size: .625rem; }
.token-reading { grid-template-columns: minmax(0,1.45fr) minmax(72px,.85fr); gap: 8px; margin-top: 5px; padding: 4px 0 2px; border-top: 0; }
.token-prices { gap: 8px; }
.token-prices > div { gap: 2px; }
.token-prices strong { font-size: .75rem; line-height: 1.3; }
.micro-label, .token-prices .delta { font-size: .625rem; line-height: 1.35; }
.token-prices small { font-size: .625rem; line-height: 1.3; }
.token-chart { min-height: 43px; gap: 0; padding: 2px; }
.token-chart .sparkline { height: 27px; }
.token-chart > span:last-child { font-size: .625rem; }
.chart-missing { min-height: 27px; font-size: .625rem; }
.token-card-bottom { min-height: 27px; gap: 6px; }
.token-status, .token-info { min-height: 26px; font-size: .625rem; padding-block: 3px; }
.token-status { padding-inline: 6px; }
.token-card-bottom > span { font-size: .625rem; }
.token-filters { padding: 8px var(--card-inset) 0; }
.selection-toolbar { padding: 5px var(--card-inset) 8px; min-height: 44px; }
.token-filters .filter-chip, .selection-toolbar .check-label, .select-cooked { min-height: 32px; }
.token-list { padding-inline: 8px; scroll-padding-block: 8px; }
.token-foot { padding: 8px var(--card-inset); min-height: 38px; flex-shrink: 0; }
.token-foot .text-button { min-height: 24px; }

/* Candidate cards: no oversized tiles or giant CTA-sized internal rows. */
.pick-head { padding: 14px var(--card-inset) 10px; min-height: 66px; flex-shrink: 0; }
.pick-head > .badge { padding: 3px 6px; }
.pick-scroll { min-height: 0; }
.picked-intro { padding: 0 var(--card-inset); min-height: 64px; }
.picked-intro h3 { font-size: .9375rem; margin-top: 3px; max-width: none; }
.picked-intro .pick-sticker { width: 58px; height: 63px; }
.pick-reason { font-size: .75rem; padding: 3px var(--card-inset) 8px; line-height: 1.5; }
.pick-state { padding: 0 var(--card-inset) 8px; gap: 8px; }
.pick-state > .art { width: 66px; height: 74px; }
.pick-state h3 { font-size: .875rem; }
.pick-state p { font-size: .75rem; line-height: 1.5; overflow-wrap: anywhere; }
.candidate-topline { margin: 0 var(--card-inset) 4px; }
.candidate-topline > .text-button { min-height: 28px; font-size: .6875rem; }
.candidate-topline > span { font-size: .6875rem; }
.candidate-list { padding: 2px 8px 4px; min-height: 0; }
.candidate { padding: 0 10px 2px; margin-bottom: 6px; border-radius: 10px; }
.candidate-select { min-height: 46px; padding: 6px 0; gap: 8px; }
.candidate-select > .token-icon { width: 30px; height: 30px; }
.candidate-identity strong { font-size: .8125rem; gap: 5px; }
.candidate-identity small { margin-top: 2px; font-size: .6875rem; }
.candidate-change { font-size: .6875rem; }
.candidate-change small { margin-top: 1px; }
.candidate-reasons { gap: 2px; padding-block: 2px 0; }
.candidate-reasons > span { font-size: .6875rem; gap: 5px; line-height: 1.4; }
.candidate-proof { min-height: 25px; padding: 3px 0; font-size: .625rem; }
.browse-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.browse-list .candidate { align-self: start; }

/* Summary remains separate from scrolling candidates, so refresh cannot push it away. */
.pick-panel { padding-bottom: 0; }
.pick-summary { padding: 8px var(--card-inset) 12px; flex-shrink: 0; border-top: 1px solid var(--line); background: #1a2425; }
.pick-summary .sol-exit { width: 100%; max-width: none; margin: 0 0 10px; min-height: 48px; padding: 7px 10px; gap: 8px; }
.pick-summary .sol-symbol { width: 28px; height: 28px; }
.pick-summary .sol-exit small { margin-top: 1px; }
.pick-summary .selected-destination { padding: 0 0 8px; gap: 8px; }
.pick-summary .selected-destination > div { gap: 2px; }
.pick-summary .selected-destination strong { font-size: .9375rem; }
.pick-summary .selected-destination .token-icon { width: 29px; height: 29px; }
.pick-summary .risk { padding: 7px 9px; margin: 0 0 8px; font-size: .6875rem; line-height: 1.45; display: flex; gap: 6px; }
.pick-summary .risk .icon { width: 14px; height: 14px; flex: none; }
.pick-summary .risk span, .pick-summary .inline-alert { overflow-wrap: anywhere; }
.pick-summary .decision-cta { padding: 0; margin: 0; position: static; background: none; max-width: none; }
.pick-summary .decision-cta > .button { min-height: 44px; font-size: .8125rem; }
.pick-summary .decision-sub { min-height: 32px; padding-top: 5px; }
.pick-summary .decision-sub .icon-button { min-width: 30px; min-height: 30px; padding: 6px; }
.pick-summary .decision-sub .text-button { min-height: 30px; font-size: .6875rem; }
.pick-summary .pip-note { font-size: .6875rem; color: var(--muted); text-align: center; margin: 6px 0 0; line-height: 1.5; }

.bag-panel .panel-head { padding: 14px var(--card-inset) 10px; min-height: 66px; }
.bag-stage { height: 176px; min-height: 176px; }
.bag-object, .is-empty .bag-object { width: 175px; height: 176px; margin: 0; }
.bag-caption { bottom: 0; font-size: .625rem; }
.stage-rings { bottom: 15px; }
.float-token { width: 28px; height: 28px; }
.bag-form { padding: 12px var(--card-inset); min-height: 0; }
.bag-total { margin-bottom: 10px; }
.bag-total strong { font-size: 1.45rem; }
.percent-global { margin-bottom: 7px; }
.percent-field { min-height: 35px; width: 76px; }
.percent-field input { min-height: 35px; padding-block: 6px; }
.amount-segments button { min-height: 32px; }
.percent-hint { margin-block: 6px 8px; }
.bag-amount-row { min-height: 55px; padding-block: 7px; }
.bag-actions { margin-top: 8px; flex-shrink: 0; }
.bag-actions .analyze-button { margin-top: 0; min-height: 44px; font-size: .8125rem; }
.bag-actions .bag-safety { min-height: 32px; margin-top: 5px; display: flex; align-items: center; justify-content: center; }

/* One source of sizing authority: app-container queries also respond to browser zoom. */
@container app-shell (min-width: 1151px) {
  .workspace { grid-template-columns: minmax(0,1fr) minmax(0,.96fr) minmax(0,1fr); align-items: stretch; }
  .workspace > section { height: var(--workspace-height); min-height: 0; max-height: none; display: flex; flex-direction: column; }
  .workspace > .pick-panel { grid-column: auto; }
  .token-panel .token-list { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; }
  .token-panel .empty-wallet { flex: 1; min-height: 0; overflow-y: auto; }
  .token-panel > .token-foot { margin-top: auto; }
  .bag-form { display: flex; flex-direction: column; flex: 1 1 0; }
  .bag-form > :not(.bag-rows) { flex-shrink: 0; }
  .bag-rows { flex: 1 1 0; min-height: 44px; max-height: none; }
  .pick-scroll { flex: 1 1 0; overflow-y: auto; padding-bottom: 6px; scrollbar-gutter: stable; }
  .pick-scroll .candidate-list { overflow: visible; max-height: none; scrollbar-gutter: auto; display: block; }
  .pick-summary { max-height: 62%; overflow-y: auto; }
}
@container app-shell (min-width: 681px) and (max-width: 1150px) {
  .workspace { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: stretch; }
  .workspace > .token-panel, .workspace > .bag-panel { height: 680px; min-height: 0; display: flex; flex-direction: column; }
  .token-panel .token-list { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; }
  .token-panel .empty-wallet { flex: 1; min-height: 0; overflow-y: auto; }
  .token-panel > .token-foot { margin-top: auto; }
  .bag-form { display: flex; flex-direction: column; flex: 1 1 0; }
  .bag-form > :not(.bag-rows) { flex-shrink: 0; }
  .bag-rows { flex: 1 1 0; min-height: 44px; max-height: none; }
  .workspace > .pick-panel { grid-column: 1/-1; display: grid; grid-template-columns: minmax(0,1fr) minmax(250px,.8fr); height: auto; min-height: 0; }
  .pick-panel > .pick-head { grid-column: 1/-1; }
  .pick-scroll { max-height: 440px; overflow-y: auto; padding-bottom: 10px; }
  .pick-scroll .candidate-list { max-height: none; display: block; overflow: visible; }
  .pick-summary { display: flex; flex-direction: column; border-top: 0; border-inline-start: 1px solid var(--line); }
  .pick-summary .decision-cta { margin-top: auto; width: 100%; }
}
@container app-shell (max-width: 680px) {
  main { padding-top: 16px; }
  .intro h1 { font-size: 1.85rem; }
  .workspace { display: flex; flex-direction: column; gap: 14px; }
  .workspace > .token-panel { display: none; }
  .workspace > .bag-panel, .workspace > .pick-panel { height: auto; min-height: 0; max-height: none; display: flex; flex-direction: column; }
  .bag-stage { height: 165px; min-height: 165px; }
  .bag-object, .is-empty .bag-object { width: 168px; height: 168px; }
  .bag-form { display: block; }
  .bag-rows { max-height: 230px; min-height: 0; }
  .bag-amount-row { min-height: 63px; }
  .percent-field, .percent-field input, .bag-amount-row .percent-field input { min-height: 44px; font-size: 16px; }
  .amount-segments button { min-height: 40px; }
  .pick-scroll { overflow: visible; padding-bottom: 8px; }
  .pick-scroll .candidate-list { max-height: 350px; display: block; overflow-y: auto; }
  .pick-summary { max-height: none; }
  .browse-list { grid-template-columns: 1fr; }
  .candidate-select { min-height: 50px; }
  .candidate-proof { min-height: 30px; }
  .rich-token { padding: 9px 10px 4px; }
  .rich-choice { min-height: 40px; gap: 8px; }
  .rich-token .token-icon { width: 32px; height: 32px; }
  .rich-token .token-name strong { font-size: .875rem; }
  .rich-token .token-value strong { font-size: .8125rem; }
  .token-reading { margin-top: 4px; padding: 3px 0 1px; gap: 8px; }
  .token-chart { min-height: 46px; }
  .token-chart .sparkline { height: 28px; }
  .token-card-bottom { min-height: 31px; }
  .token-status, .token-info { min-height: 30px; }
}
.token-list, .bag-rows, .pick-scroll { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #6b8057 transparent; }
.token-list:focus-visible, .bag-rows:focus-visible, .pick-scroll:focus-visible { outline: 2px solid var(--action); outline-offset: -2px; }
@media (forced-colors: active) {
  .pick-summary { background: Canvas; border-color: CanvasText; }
  .token-list:focus-visible, .bag-rows:focus-visible, .pick-scroll:focus-visible { outline-color: Highlight; }
}

/* Dialog is a sibling of #app: own container avoids missing mobile rules in the top layer. */
#sheet.picker { container-type: inline-size; container-name: token-picker; }
@container token-picker (max-width: 760px) {
  .rich-choice { min-height: 44px; }
  .token-status, .token-info { min-height: 30px; }
  .rich-token .token-name strong { font-size: .875rem; }
  .token-card-bottom { min-height: 31px; }
  .token-chart { min-height: 46px; }
  .token-chart .sparkline { height: 28px; }
}
