/* Tezos LowFi — minimal dark instrument panel
   Flat surfaces, hairline rules only where they carry structure,
   typography and whitespace do the rest. */

:root {
  --bg: #0b0d10;
  --bg-raised: #101317;
  --bg-input: #0d1014;

  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.05);

  --text-1: #e9ebee;
  --text-2: #9aa3ad;
  --text-3: #5d6570;

  --accent: #00e699;
  --accent-dim: rgba(0, 230, 153, 0.1);
  --blue: #6fb1ff;
  --red: #ff5c7a;
  --gold: #e8c268;
  --silver: #b8bec7;
  --bronze: #c98d5a;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(0, 230, 153, 0.22);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #1d222a;
  border-radius: 5px;
  border: 3px solid var(--bg);
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 248px;
  background: var(--bg);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 6px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-title span {
  color: var(--text-2);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-family: var(--font-main);
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-btn .nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-btn:hover {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 22%;
  bottom: 22%;
  width: 2px;
  background: var(--accent);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: auto;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.sidebar-status {
  padding: 14px 6px 0;
  background: transparent;
  border: none;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.online { background: var(--accent); }
.dot.offline { background: var(--red); }

.status-sub {
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-footer {
  margin-top: 14px;
  padding: 12px 6px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.68rem;
  line-height: 1.8;
  color: var(--text-3);
}

.sidebar-footer a {
  color: var(--text-2);
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--accent);
}

/* ---------- Main content ---------- */

.main-content {
  flex: 1;
  padding: 28px 36px 48px;
  overflow-y: auto;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
}

.top-header h1 {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.subtitle {
  color: var(--text-2);
  font-size: 0.85rem;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ---------- Surfaces ----------
   Cards are whitespace, not boxes. Hairlines only where
   rows need separation (tables, ticker, panel edges). */

.glass-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 20px 0;
}

.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  padding: 0;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-container {
  padding: 0;
  overflow: auto;
  max-height: min(640px, 72vh);
  border-top: 1px solid var(--line);
}

.ticker-wrapper {
  padding: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.discover-panel {
  margin-bottom: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  animation: fadeIn 0.2s ease;
}

.discover-panel.hidden {
  display: none;
}

/* ---------- Buttons ---------- */

.glass-btn {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-family: var(--font-main);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.glass-btn:hover {
  color: var(--text-1);
  border-color: rgba(255, 255, 255, 0.22);
}

.glass-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06080a;
  font-weight: 600;
}

.glass-btn.primary:hover {
  background: #3cecaf;
  border-color: #3cecaf;
}

.glass-btn.small {
  padding: 5px 10px;
  font-size: 0.72rem;
}

.glass-btn.active {
  background: var(--accent-dim);
  border-color: rgba(0, 230, 153, 0.35);
  color: var(--accent);
}

.glass-btn.secondary {
  background: transparent;
  border-color: rgba(255, 92, 122, 0.35);
  color: var(--red);
}

.glass-btn.secondary:hover {
  background: rgba(255, 92, 122, 0.08);
  border-color: rgba(255, 92, 122, 0.5);
}

.glass-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

/* ---------- Inputs ---------- */

.glass-select,
.glass-input,
.search-box input {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-family: var(--font-main);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.glass-select:focus,
.glass-input:focus,
.search-box input:focus {
  border-color: rgba(0, 230, 153, 0.5);
}

.glass-select option {
  background: var(--bg-raised);
  color: var(--text-1);
}

.search-box input {
  width: 280px;
}

.search-box input::placeholder,
.glass-input::placeholder {
  color: var(--text-3);
}

/* ---------- View panels ---------- */

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Live swap ticker ---------- */

.ticker-header {
  display: grid;
  grid-template-columns: 90px 230px 1fr 180px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.swap-feed {
  max-height: 600px;
  overflow-y: auto;
}

.swap-row {
  display: grid;
  grid-template-columns: 90px 230px 1fr 180px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.82rem;
  align-items: center;
  animation: slideDown 0.18s ease;
}

.swap-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.time { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); }
.provider { font-weight: 600; font-size: 0.78rem; color: var(--blue); }

/* Provider + platform stacked in a single column; the status badge sits
   on its own row below both so it never crowds the details column */
.provider-cell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "name"
    "platform"
    "badge";
  row-gap: 2px;
  align-items: center;
  justify-items: start;
  min-width: 0;
}

.provider { grid-area: name; }

.provider-cell .swap-status {
  grid-area: badge;
  margin-left: 0;
  margin-top: 1px;
}

.platform {
  grid-area: platform;
  font-size: 0.68rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.details { font-family: var(--font-mono); font-size: 0.78rem; }

/* In / out legs on their own lines */
.swap-line-in,
.swap-line-out {
  display: block;
}

.swap-line-out {
  color: var(--text-2);
}

.trader { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); }

.coin-highlight {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-dim);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

/* Route hops: expand chip on the platform line + panel under the row */
.hops-toggle {
  margin-left: 8px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
}

.hops-toggle:hover,
.hops-toggle.open {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.swap-hops {
  padding: 6px 16px 8px 34px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.015);
}

.hop-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 2px 0;
  font-size: 0.72rem;
}

.hop-idx {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
}

.hop-provider {
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--blue);
}

.hop-platform {
  color: var(--text-3);
  font-weight: 400;
}

.hop-details {
  font-family: var(--font-mono);
  color: var(--text-2);
}

.hop-details .swap-line-in,
.hop-details .swap-line-out {
  display: inline;
}

.hop-details .swap-line-out {
  margin-left: 6px;
}

/* ---------- Data tables ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  position: sticky;
  top: 0;
  z-index: 2;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.84rem;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ---------- Table pagination ---------- */

.pager-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  font-size: 0.72rem;
  color: var(--text-2);
}

.pager-bar:empty {
  display: none;
}

.pager-info {
  font-family: var(--font-mono);
}

.pager-page {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.66rem;
}

.pager-nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ---------- Toast notifications ---------- */

#toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.22s ease-out;
}

.toast-success { border-left-color: var(--accent); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--blue); }

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 700;
}

.toast-success .toast-icon { background: var(--accent-dim); color: var(--accent); }
.toast-error .toast-icon { background: rgba(255, 92, 122, 0.12); color: var(--red); }
.toast-info .toast-icon { background: rgba(111, 177, 255, 0.12); color: var(--blue); }

.toast-msg {
  flex: 1;
  line-height: 1.35;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px;
}

.toast-close:hover {
  color: var(--text-1);
}

.toast-out {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Button loading state ---------- */

.glass-btn.btn-loading,
.glass-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.glass-btn:disabled:not(.btn-loading) {
  cursor: not-allowed;
}

.btn-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -1px;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Identity ---------- */

.avatar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raised);
  flex-shrink: 0;
}

.wallet-addr {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-2);
  text-decoration: none;
}

a.wallet-addr:hover {
  color: var(--accent);
}

.identity-name {
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--text-1);
  text-decoration: none;
}

a.identity-name:hover {
  color: var(--accent);
}

.identity-name.muted {
  color: var(--text-3);
  font-weight: 400;
}

.social-badge {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  margin-right: 4px;
}

.social-badge:hover {
  border-color: rgba(111, 177, 255, 0.5);
  color: var(--blue);
}

/* ---------- Layout helpers ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.dao-summary pre {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: pre-wrap;
  margin-top: 14px;
}

.text-center { text-align: center; color: var(--text-3); }
.empty-state { padding: 48px 24px; text-align: center; color: var(--text-3); font-size: 0.85rem; }

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 8px;
}

.summary-cards .glass-card {
  padding: 0;
}

.summary-cards h3 {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header.mb-sm { margin-bottom: 14px; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-actions .glass-btn.primary { flex: 1; }

.scanned-token-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.8rem;
}

.scanned-token-balance {
  font-family: var(--font-mono);
  color: var(--accent);
}

.owned-tokens-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.discover-subtitle {
  margin-top: 6px;
  margin-bottom: 16px;
}

.section-title {
  margin-bottom: 16px;
}

.section-title.tight {
  margin-bottom: 6px;
}

.leaderboard-card,
.distribution-card {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.min-holdings-label {
  margin-left: 8px;
}

.min-holdings-input {
  width: 100px;
}

.token-info-badge {
  margin-left: 4px;
}

.modal-header {
  margin-bottom: 14px;
}

.modal-subtitle {
  margin-bottom: 16px;
}

.wallet-scanned-tokens {
  margin-top: 14px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.scanned-tokens-header {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.scanned-empty {
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ---------- Discover panel ---------- */

.discover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 14px;
}

.discover-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-msg {
  margin-top: 14px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-msg.success { color: var(--accent); }
.status-msg.error { color: var(--red); }
.status-msg.loading { color: var(--blue); }

/* ---------- PepePot stats ---------- */

.stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
  margin-bottom: 16px;
}

.stat-card-value {
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 6px;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.stat-card-value .small-addr {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
  font-family: var(--font-main);
}

.rank-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  background: none;
  border: none;
}
.rank-badge.top-1 { color: var(--gold); }
.rank-badge.top-2 { color: var(--silver); }
.rank-badge.top-3 { color: var(--bronze); }

.sortable-th {
  cursor: pointer;
  user-select: none;
}
.sortable-th:hover {
  color: var(--accent);
}

.chart-card {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.svg-chart-container {
  width: 100%;
  height: 260px;
  margin-top: 16px;
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 90%;
  max-width: 520px;
  padding: 26px 28px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* ---------- Owned token pills ---------- */

.owned-tokens-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 16px;
}

.owned-token-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.owned-token-pill:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #06080a;
}

.owned-token-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #06080a;
}

/* Compact owned-token dropdown picker */
.owned-picker {
  position: relative;
  display: inline-block;
}

.owned-picker-btn {
  cursor: pointer;
  font-size: 0.78rem;
  white-space: nowrap;
}

.owned-picker-caret {
  color: var(--text-3);
  font-size: 0.7rem;
}

.owned-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 220px;
  max-width: 280px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
}

.owned-picker-panel.hidden {
  display: none;
}

.owned-picker-list {
  max-height: 240px;
  overflow-y: auto;
}

.owned-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-2);
  cursor: pointer;
}

.owned-picker-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.owned-picker-row input {
  accent-color: var(--accent);
  cursor: pointer;
}

.owned-picker-box {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  flex-shrink: 0;
}

.owned-picker-row.checked .owned-picker-box {
  background: var(--accent);
  border-color: var(--accent);
}

.owned-picker-row.muted {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- Pool reference cell (pairs catalog) ---------- */

.pool-bigmap-id {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  cursor: help;
}

.factory-addr {
  opacity: 0.75;
}

.owned-picker-all {
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
  padding-bottom: 6px;
  color: var(--text-1);
  font-weight: 600;
}

.owned-picker-clear {
  cursor: pointer;
  color: var(--text-3);
  padding: 0 3px;
}

.owned-picker-clear:hover {
  color: var(--red);
}

.owned-picker-clear-row {
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
  padding-top: 6px;
  color: var(--text-2);
}

.owned-picker-clear-row:hover {
  color: var(--text-1);
}

.owned-picker-clear-row.hidden {
  display: none;
}

.owned-picker-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-1);
}

.owned-picker-balance {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
}

.owned-badge {
  display: inline-block;
  padding: 1px 6px;
  background: transparent;
  border: 1px solid rgba(0, 230, 153, 0.4);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
}

/* Operation status badge in the live feed (backtracked / failed / skipped) */
.swap-status {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  border: 1px solid rgba(255, 77, 77, 0.45);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: help;
}

/* Rows whose operation never applied: dimmed — no tokens actually moved */
.swap-row-not-applied {
  opacity: 0.55;
}

.swap-row-not-applied .details {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 77, 77, 0.5);
}

/* Row updated with the confirmed (actual) output value */
.swap-row-resolved .details {
  color: var(--text-1);
}

/* Pulsing dot: actual output not confirmed yet (min-out floor shown) */
.swap-pending {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--gold);
  vertical-align: middle;
  cursor: help;
  animation: swap-pending-pulse 1s ease-in-out infinite;
}

@keyframes swap-pending-pulse {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- Responsive ---------- */

/* Medium widths leave room to spare — swap legs on a single line */
@media (min-width: 640px) and (max-width: 1100px) {
  .swap-line-in,
  .swap-line-out {
    display: inline;
  }

  .swap-line-out {
    margin-left: 6px;
  }
}

@media (max-width: 1100px) {
  .ticker-header,
  .swap-row {
    grid-template-columns: 80px 190px 1fr 150px;
  }
}

@media (max-width: 980px) {
  /* Page scrolls naturally; footer sits at the end of the document */
  .app-layout {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "brand status"
      "nav nav"
      "main main"
      "footer footer";
  }

  .sidebar {
    display: contents;
  }

  .brand {
    grid-area: brand;
    margin-bottom: 0;
    padding: 14px 0 14px 16px;
  }

  .nav-menu {
    grid-area: nav;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--line-soft);
  }

  .nav-btn.active::before {
    left: 6px;
    right: 6px;
    top: auto;
    bottom: 0;
    width: auto;
    height: 2px;
  }

  .sidebar-status {
    grid-area: status;
    padding: 14px 16px 14px 0;
  }

  .sidebar-footer {
    grid-area: footer;
    margin-top: 0;
    padding: 14px 16px;
    border-top: 1px solid var(--line-soft);
  }

  .main-content {
    grid-area: main;
    padding: 20px 16px 40px;
  }

  /* Feed flows with the page instead of scrolling inside a 600px box */
  .swap-feed {
    max-height: none;
    overflow-y: visible;
  }

  .top-header {
    flex-direction: column;
    gap: 12px;
  }

  .controls-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .search-box input {
    width: 100%;
  }

  .search-box {
    flex: 1 1 100%;
  }

  .grid-2,
  .discover-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ticker-header,
  .swap-row {
    grid-template-columns: 170px 1fr 120px;
  }

  .ticker-header span:nth-child(1),
  .swap-row .time {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 0.95rem;
  }

  .top-header h1 {
    font-size: 1.2rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }

  .summary-cards,
  .stats-grid-3 {
    gap: 16px;
  }

  /* Footer credits on a single line */
  .sidebar-footer {
    display: flex;
    align-items: baseline;
    gap: 0 8px;
    white-space: nowrap;
    overflow: hidden;
  }

  .sidebar-footer div {
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ---------- Holder composition drill-down ---------- */

.expand-col {
  width: 34px;
}

.expand-cell {
  text-align: center;
}

.holder-expand {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.holder-expand:hover,
.holder-expand.open {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.holder-comp-row > td {
  padding: 0;
  border-bottom: 1px solid var(--line-soft);
}

.holder-comp {
  padding: 10px 18px 12px 34px;
  background: rgba(255, 255, 255, 0.015);
}

.comp-loading {
  font-size: 0.72rem;
  color: var(--text-3);
  padding: 4px 0;
}

.comp-total {
  font-size: 0.76rem;
  color: var(--text-2);
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.comp-total strong {
  color: var(--accent);
}

.comp-group {
  padding: 3px 0;
}

.comp-group-title {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 2px 0;
}

.comp-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 2px 0 2px 10px;
  font-size: 0.72rem;
}

.comp-kind {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--text-3);
  text-transform: lowercase;
}

.comp-kind-wallet {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.comp-kind-stake,
.comp-kind-lock {
  color: var(--blue);
  border-color: rgba(96, 165, 250, 0.35);
}

.comp-kind-lp,
.comp-kind-lp-staked {
  color: var(--yellow, #e6c229);
  border-color: rgba(230, 194, 41, 0.35);
}

.comp-provider {
  font-weight: 600;
  color: var(--text-2);
}

.comp-pair {
  font-family: var(--font-mono);
  color: var(--text-3);
}

.comp-amount {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--text-2);
}

/* ---------- My Holdings card view ---------- */

.my-holdings-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  padding-bottom: 16px;
}

.my-holding-card .my-holding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.my-holding-card .my-holding-head h3 {
  margin: 0;
}

.my-holding-card .holder-comp {
  padding: 6px 0 0;
  background: transparent;
}

.my-holdings-empty {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--text-3);
}

@media (max-width: 700px) {
  .holder-comp {
    padding-left: 16px;
  }

  .comp-amount {
    margin-left: 0;
  }
}

/* ---------- Inline SVG icons (emoji-free) ---------- */

.i {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.glass-btn .i,
h3 .i,
.owned-tokens-label .i,
.status-sub .i {
  margin-right: 4px;
}

.holder-expand .i {
  width: 11px;
  height: 11px;
}

.toast-icon .i {
  width: 12px;
  height: 12px;
}

.toast-close .i {
  width: 12px;
  height: 12px;
}

.owned-picker-caret .i {
  width: 10px;
  height: 10px;
}

.owned-badge .i {
  width: 11px;
  height: 11px;
}
