.table-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--line-light), 0 8px 24px 0 rgba(0, 0, 0, .5);
  overflow: hidden;
}
.table-tools { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.table-tools input {
  width: 100%; max-width: 280px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 9999px; background: var(--card); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line); font: inherit;
}
.table-tools input:focus { outline: none; box-shadow: 0 0 0 1px var(--accent); }

.vote-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.vote-table .col-stat { width: 26%; }
.vote-table th {
  height: 48px; padding: 0 20px; text-align: left; font-weight: 500;
  color: var(--ink-muted); font-size: 12px; border-bottom: 1px solid var(--line);
}
.vote-table th.num, .vote-table td.num { text-align: right; }
.vote-table th button { all: unset; cursor: pointer; }
.vote-table th button:hover { color: var(--ink); }
.vote-table th button[data-dir]::after { content: " ↓"; color: var(--brand); }
.vote-table th button[data-dir="asc"]::after { content: " ↑"; }
.vote-table td { height: 64px; padding: 10px 20px; border-bottom: 1px solid var(--line-light); vertical-align: middle; }
.vote-table tbody tr.pool { cursor: pointer; }
.vote-table tbody tr.pool:hover td { background: var(--hover); }
.vote-table tbody tr.pool[aria-expanded="true"] td { background: rgba(255, 255, 255, .03); }
.empty { text-align: center; color: var(--ink-muted); }

.market { display: flex; align-items: center; gap: 12px; }
.rank { width: 20px; color: var(--ink-faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* fables.fi style pair mark: left half base token, right half quote token */
.pair-logo { --pair-logo: 32px; position: relative; width: var(--pair-logo); height: var(--pair-logo); flex: none; display: inline-block; }
.pair-logo .half { position: absolute; top: 0; display: flex; width: calc(var(--pair-logo) / 2 - 1px); height: var(--pair-logo); overflow: hidden; }
.pair-logo .left { left: 0; }
.pair-logo .right { right: 0; flex-direction: row-reverse; }
.mono {
  position: relative; flex: none; width: var(--pair-logo); height: var(--pair-logo); border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--control); color: var(--ink-secondary); font-weight: 600; font-size: calc(var(--pair-logo) * .4);
}
.mono img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* charts */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-card {
  margin: 0; padding: 24px; border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-light), 0 8px 24px 0 rgba(0, 0, 0, .5);
  position: relative; overflow: hidden;
}
.chart-card::before {
  content: ""; position: absolute; inset: -40% -40% auto auto; width: 70%; aspect-ratio: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 10%, transparent), transparent 65%);
  pointer-events: none;
}
.chart-card figcaption h3 { margin: 0; font-size: 16px; font-weight: 600; }
.chart-card figcaption p { margin: 4px 0 0; color: var(--ink-muted); font-size: 12px; }
.donut { position: relative; width: min(100%, 260px); aspect-ratio: 1; margin: 20px auto 16px; }
.donut svg { display: block; width: 100%; height: 100%; overflow: visible; }
.donut path { transition: transform .18s ease, opacity .18s ease, filter .18s ease; cursor: pointer; }
.focused .donut path { opacity: .3; }
.focused .donut path.on { opacity: 1; transform: translate(var(--dx), var(--dy)); filter: drop-shadow(0 0 10px var(--c)); }
.sweep { stroke-dasharray: 100 100; stroke-dashoffset: 0; animation: sweep .7s cubic-bezier(.3, .7, .2, 1) both; }
@keyframes sweep { from { stroke-dashoffset: 100; } }
@media (prefers-reduced-motion: reduce) { .sweep { animation: none; } .donut path { transition: none; } }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; padding: 0 70px;
}
.dc-logo:empty { display: none; }
.dc-logo { margin-bottom: 4px; }
.dc-logo .pair-logo { --pair-logo: 28px !important; }
.dc-value { font-size: 26px; line-height: 30px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }
.dc-label { color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legend li {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px;
  font-size: 12px; color: var(--ink-secondary); cursor: default;
}
.legend li.on { background: var(--hover); color: var(--ink); }
.legend li > i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend .lg-label { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.legend small { color: var(--ink-faint); font-size: 11px; }
.legend b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.pair { font-weight: 500; }
.pair .q { color: var(--ink-muted); font-weight: 400; }
.pool-id { color: var(--ink-faint); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tag { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(255, 119, 61, .15); color: #ff773d; font-size: 11px; }

.metric { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 140px; }
.metric-top { font-weight: 500; font-variant-numeric: tabular-nums; }
.metric-sub { color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bar { width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 2px; background: var(--brand); }
.bar.alt > i { background: var(--accent); }

.voters-row td { padding: 0 20px 16px; background: rgba(255, 255, 255, .03); }
.voter-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 24px; padding-top: 4px; }
.voter { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-light); font-size: 12px; }
.voter a { color: var(--ink-secondary); text-decoration: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.voter a:hover { color: var(--brand); }
.voter span { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.voter b { color: var(--ink); font-weight: 500; }

.note { color: var(--ink-faint); font-size: 12px; line-height: 18px; margin: 16px 4px 0; max-width: 820px; }

@media (max-width: 720px) {
  .vote-table { min-width: 0; }
  .vote-table .col-stat { width: 30%; }
  .pool-id { display: none; }
  .market .pair-logo { display: none; }
  .charts { grid-template-columns: 1fr; }
  .chart-card { padding: 18px; }
  .market { gap: 0; }
  .metric { min-width: 0; width: 100%; }
  .vote-table td, .vote-table th { padding-inline: 12px; }
  .rank { display: none; }
}

/* page head side: history links and snapshot info */
.head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.head-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; border: 0; cursor: pointer; font-family: inherit; color: var(--ink); }

/* your votes (connected wallet) */
.my-votes { margin-bottom: 24px; }
.my-votes:empty { display: none; }
.my-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 12px 12px 20px; border-radius: var(--radius); color: var(--ink-secondary);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line-light);
}
.my-empty a:not(.btn) { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.my-card {
  padding: 20px 24px; border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 45%, transparent), 0 8px 24px rgba(0, 0, 0, .5);
}
.my-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.my-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.my-addr a { color: var(--ink-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-decoration: none; }
.my-addr a:hover { color: var(--brand); }
.my-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.my-stats span { display: block; color: var(--ink-muted); font-size: 12px; }
.my-stats b { font-size: 22px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.my-stats small { color: var(--ink-faint); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.my-pools { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 24px; max-height: 280px; overflow-y: auto; }
.my-pools li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-light); font-size: 13px; }
.my-pair { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-num { color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.my-num b { color: var(--ink); font-weight: 500; }
.tag.you { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
.voter.me a, .voter.me b { color: var(--brand); }

/* history */
.history-table { min-width: 760px; }
.history-table tbody tr { cursor: pointer; }
.history-table tbody tr:hover td { background: var(--hover); }
.history-table td { font-variant-numeric: tabular-nums; }
.epoch-link { display: flex; flex-direction: column; text-decoration: none; }
.epoch-link b { font-weight: 500; }
.epoch-link span { color: var(--ink-muted); font-size: 12px; }
.status { padding: 2px 8px; border-radius: 9999px; font-size: 12px; }
.status.live { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
.status.final { background: rgba(255, 255, 255, .08); color: var(--ink-secondary); }
.top-pool { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }
.top-pool .q { color: var(--ink-muted); font-weight: 400; margin-left: -8px; }
.top-pool small { color: var(--ink-muted); font-weight: 400; }
.you-cell b { display: block; font-weight: 500; }
.you-cell small, .muted { color: var(--ink-muted); font-size: 12px; }

@media (max-width: 720px) {
  .head-side { align-items: flex-start; }
  .head-links { justify-content: flex-start; }
  .my-card { padding: 16px; }
  .my-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .my-pools { grid-template-columns: 1fr; }
  .my-pools li { flex-wrap: wrap; row-gap: 2px; }
  .my-num { flex-basis: 100%; padding-left: 34px; white-space: normal; }
}
