/* /pools/:token — the chart, the range picker and the position builder. */

.token-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  align-items: start;
}

.lf-chartcol {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.positions-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
}

/* ------------------------------------------------------------- token hero */

.tok-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 10px;
}
.tok-hero-id {
  font-family: var(--f-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.tok-hero-name {
  font-size: 13px;
  color: var(--ink-2);
}
.tok-hero-addr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.tok-copy {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  padding: 2px;
  border-radius: var(--r-sm);
}
.tok-copy:hover {
  color: var(--lime);
}

/* --------------------------------------------------------- market picker */

.market-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mkt-dd {
  position: relative;
}
.mkt-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 11px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}
.mkt-dd-btn:hover {
  border-color: var(--line-3);
}
.mkt-dd-btn[aria-expanded='true'],
.mkt-dd-btn.on {
  border-color: var(--lime);
  color: var(--lime);
}
.mkt-dd-value {
  color: var(--ink-2);
  font-size: 10.5px;
}
.mkt-dd-btn.on .mkt-dd-value {
  color: inherit;
}
.mkt-dd-chev {
  display: inline-flex;
  color: var(--ink-3);
}
.mkt-dd-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  padding: 4px;
}
.mkt-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 11.5px;
  cursor: pointer;
  text-align: left;
}
.mkt-dd-item:hover {
  background: var(--raised);
}
.mkt-dd-item[aria-selected='true'] {
  color: var(--lime);
}
.mkt-dd-item .meta {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 10px;
}
.mkt-tag {
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.mkt-tag.v4 {
  border-color: color-mix(in srgb, var(--lime) 45%, var(--line));
  color: var(--lime);
}

/* ---------------------------------------------------------- chart toolbar */

.lf-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 2px;
}
.tf-row button,
.tool-group button {
  padding: 5px 10px;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  background: none;
  border: 0;
  border-radius: var(--r-full);
  color: var(--ink-2);
  transition: all var(--dur-press) var(--ease);
}
.tf-row button:hover,
.tool-group button:hover {
  color: var(--ink-bright);
}
.tf-row button.active,
.tool-group button.active {
  color: var(--on-lime);
  background: var(--lime);
  font-weight: 700;
}

/* ------------------------------------------------------------ range chart */

.range-chart {
  position: relative;
}
.rc-host {
  position: relative;
  width: 100%;
  height: 340px;
  touch-action: none;
  user-select: none;
}
.rc-plot {
  display: block;
  width: 100%;
  height: 100%;
}
.rc-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* The band between the two guides: this is the position's range. */
.rc-band {
  position: absolute;
  left: 0;
  right: 56px;
  background: var(--band-fill);
  border-top: 1px solid var(--band-edge);
  border-bottom: 1px solid var(--band-edge);
  pointer-events: none;
}
.rc-rungs {
  position: absolute;
  right: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1px;
  pointer-events: none;
}
.rc-rungs i {
  display: block;
  height: 3px;
  background: var(--lime);
  opacity: 0.55;
  border-radius: 2px;
}
/* Draggable guides. The hit area is deliberately taller than the line so the
   handle can be grabbed on a touch screen. */
.rc-handle {
  position: absolute;
  left: 0;
  right: 56px;
  height: 18px;
  margin-top: -9px;
  cursor: ns-resize;
  pointer-events: auto;
  display: flex;
  align-items: center;
}
.rc-handle::before {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--band-edge);
  border-top: 1px dashed transparent;
}
.rc-handle span {
  margin-left: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--on-lime);
  background: var(--lime);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.rc-handle:hover span,
.rc-handle.dragging span {
  background: var(--lime-bright);
}
.rc-axis {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56px;
  pointer-events: none;
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--chart-text);
}
.rc-axis span {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-variant-numeric: tabular-nums;
}
.rc-now {
  position: absolute;
  right: 2px;
  transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  color: #fff;
  background: var(--chart-down);
}
.rc-now.up {
  background: var(--chart-up);
  color: var(--on-lime);
}
.rc-hint {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: center;
  padding: 6px 0 0;
}
.rc-unit {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 14px 10px;
}

/* ------------------------------------------------------------ chart stats */

.chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
.chart-stats .stat {
  background: var(--panel);
  padding: 11px 14px;
}

/* --------------------------------------------------------- action panel */

.action-panel {
  background-color: var(--panel);
  background-image: var(--card-wash);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.action-panel h3 {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-2);
}
.ap-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 2px;
}
.tabs button {
  flex: 1;
  padding: 7px 8px;
  background: none;
  border: 0;
  border-radius: var(--r-full);
  color: var(--ink-2);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--dur-press) var(--ease);
}
.tabs button:hover {
  color: var(--ink-bright);
}
.tabs button[aria-selected='true'] {
  color: var(--on-lime);
  background: var(--lime);
  font-weight: 700;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 calc(50% - 0.33rem);
  min-width: 0;
}
.field label {
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
}
.input-affix {
  display: flex;
  align-items: center;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0 10px;
  transition: border-color var(--dur) var(--ease);
}
.input-affix:focus-within {
  border-color: var(--lime);
}
.input-affix input,
.input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 9px 0;
}
.input {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 10px;
  width: 100%;
}
.input:focus {
  border-color: var(--lime);
  outline: none;
}
.affix {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  white-space: nowrap;
  padding-left: 8px;
}
.affix.pct {
  color: var(--lime);
}
.affix button {
  background: none;
  border: 0;
  color: var(--lime);
  font: inherit;
  cursor: pointer;
  padding: 2px 4px;
}
.unit-hint {
  color: var(--ink-3);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.field-note {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-2);
}
.bins-note-slot {
  font-size: 11px;
  line-height: 1.35;
  min-height: calc(2em * 1.35 + 4px);
}

.build-btn {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 12px;
}

/* -------------------------------------------------------- bin preview */

.bin-preview {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 54px;
  padding: 8px 0 0;
}
.bin-preview i {
  flex: 1;
  min-width: 2px;
  background: var(--lime);
  opacity: 0.45;
  border-radius: 2px 2px 0 0;
  transition: height var(--dur) var(--ease);
}
.bin-preview i.token0 {
  background: var(--chart-up);
}
.bin-preview i.token1 {
  background: var(--lime);
}
.bin-preview i.both {
  background: var(--ink);
  opacity: 0.8;
}
.bin-legend {
  display: flex;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.bin-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
}

/* ----------------------------------------------------------- positions */

.positions-scroll {
  max-height: var(--positions-max-h);
  overflow-y: auto;
}
.pos-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.pos-item:last-child {
  border-bottom: 0;
}
.pos-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11.5px;
}
.pos-range {
  color: var(--ink-2);
  font-size: 10.5px;
  font-family: var(--f-mono);
}
.pos-badge {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.pos-badge.in {
  border-color: color-mix(in srgb, var(--pos) 50%, var(--line));
  color: var(--pos);
}

/* --------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-card h3 {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-2);
}
.wallet-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.wallet-option:hover {
  border-color: var(--lime);
}
.wallet-option img {
  border-radius: var(--r-sm);
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .token-page {
    grid-template-columns: minmax(0, 1fr);
  }
  .positions-col {
    position: static;
  }
}
@media (max-width: 720px) {
  .rc-host {
    height: 260px;
  }
  .field {
    flex-basis: 100%;
  }
}

/* ==========================================================================
   /positions

   The .pos-* family above was written for the narrow sidebar column on the
   token page. These rules extend it to a full-width page - a header band, a
   summary strip and a fact grid inside each row - without touching anything
   above. Only two existing selectors are refined, both scoped to .pos-page.
   ========================================================================== */

.pos-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pos-page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pos-page-title {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.pos-page-head .btn {
  margin-left: auto;
}
.pos-page-note {
  margin: -6px 0 0;
  max-width: 90ch;
  font-family: var(--f-sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

.pos-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  font-family: var(--f-mono);
}
.pos-strip .stat {
  padding: 11px 16px;
  border-right: 1px solid var(--line);
}
.pos-strip .stat:last-child {
  border-right: 0;
}

.pos-list {
  display: flex;
  flex-direction: column;
}
/* The sidebar version aligns on the baseline for a single line of text; a full
   row carries token icons and chips, which want centring instead. */
.pos-page .pos-head {
  align-items: center;
  flex-wrap: wrap;
}
.pos-page .pos-item {
  padding: 13px 16px;
  gap: 5px;
}
.pos-item.pos-idle {
  opacity: 0.62;
}
.pos-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
}
.pos-fee {
  font-size: 10.5px;
  color: var(--ink-2);
}
.pos-warn {
  color: var(--neg);
}

.pos-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 18px;
  margin-top: 5px;
}
.pos-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pos-fact .k {
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
}
.pos-fact .v {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos-fact a {
  color: var(--lime);
  text-decoration: none;
}
.pos-fact a:hover {
  text-decoration: underline;
}

.pos-cta {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.pos-cta .btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.pos-scan {
  padding: 2px 2px 0;
  color: var(--ink-3);
}

@media (max-width: 720px) {
  .pos-page-note {
    max-width: none;
  }
  .pos-page-head .btn {
    margin-left: 0;
  }
}
