[hidden]{display:none!important}
main{max-width:1480px;margin:auto}
.wallet-form{display:flex;flex-wrap:wrap;align-items:end;gap:.75rem}
.wallet-form label{display:grid;gap:.35rem}
#wallet{width:min(25rem,75vw)}
#limit{width:9rem}
#summary,#flows,#scenarios,#price-allocation{display:grid;gap:.6rem}
#summary{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:1fr}
#price-allocation{grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:1fr}
#flows{grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr))}
#scenarios{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
.metric,.scenario{border:1px solid #343b36;background:#191d1a;border-radius:.65rem;padding:.65rem .75rem;margin:0}
.metric{display:flex;flex-direction:column;justify-content:space-between;gap:.25rem;min-width:0}
.metric dd,.scenario dd{margin:0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.scenario dd{text-align:right}
.metric dt,.notes,#status,#book-status{color:#a3ada5}
.metric dd{font-size:1.05rem;font-weight:600}
#exit{margin:1rem 0;padding:1rem;border:1px solid #343b36;border-radius:.75rem}
.scenario dl{display:grid;gap:.4rem .65rem;grid-template-columns:minmax(0,1fr) minmax(0,44%);margin:0}
.scenario h3{margin:0 0 .6rem}
#closed-positions tr{color:#a3ada5}
#closed-section .scroll{margin-top:.7rem}
:is(#positions,#closed-positions) td:first-child{text-align:left;white-space:normal;min-width:15rem}
#positions button{white-space:nowrap}

.polymarket {
  color-scheme: dark;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0, #26372e 0, transparent 38rem), #111613;
  color: #eef3ed;
}
.polymarket .analytics-header {
  border-bottom: 1px solid #34463b;
  background: #161e19;
  box-sizing: border-box;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: .8rem 1rem;
}
.polymarket .header-wordmark {color: #a4c5ae;letter-spacing: .12em}
.polymarket h1 {font-size: 1.25rem;letter-spacing: -.025em;margin: .2rem 0 0}
.polymarket main {box-sizing: border-box;padding: 1rem;font-size: .875rem}
.polymarket h2 {font-size: 1rem;margin: 1rem 0 .55rem}
.polymarket h3 {font-size: .9rem}
.polymarket #login, .polymarket #wallet-form {
  background: #19231d;
  border: 1px solid #384b3f;
  box-shadow: 0 16px 40px #0003;
  border-radius: 1rem;
  padding: .85rem 1rem;
}
.polymarket #login {margin: 1rem auto;max-width: 22rem}
.polymarket #wallet-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label label" "input actions" "hint hint";
  align-items: start;
  gap: .35rem .6rem;
}
.polymarket #wallet-form label {grid-area: label}
.polymarket #wallet-hint {grid-area: hint}
.polymarket #wallet {grid-area: input}
.polymarket .wallet-actions {grid-area: actions}
.polymarket #wallet {
  width: 100%;
  resize: vertical;
  box-sizing: border-box;
  padding: .25rem .65rem;
  height: 2.5rem;
  min-height: 2.5rem;
  border: 1px solid #46594b;
  border-radius: .55rem;
  background: #111914;
  color: #e8f4eb;
  font: .8125rem/.9375rem ui-monospace, monospace;
}
.polymarket button, .polymarket input {box-sizing: border-box;min-height: 2.5rem;font: inherit}
.polymarket button {
  border-radius: .6rem;
  transition: background-color .18s, border-color .18s, transform .18s;
}
.polymarket button:hover:not(:disabled) {transform: translateY(-1px);border-color: #9fc5aa}
.polymarket :is(button, input, textarea, summary):focus-visible {outline: 2px solid #aad8b5;outline-offset: 3px}
.polymarket #wallet-form button[type=button] {background: #17211a;color: #c9dccd}
.wallet-actions {display: flex;align-items: center;gap: .5rem}
.polymarket #wallet-form button {white-space: nowrap;padding: .4rem .7rem}
#wallet-hint, #wallet-errors, .polymarket .notes {color: #b0c3b5;line-height: 1.5}
#wallet-errors {padding-left: 1.25rem;overflow-wrap: anywhere}
.polymarket .metric, .polymarket .scenario {
  background: linear-gradient(150deg, #223128, #19231d);
  border-color: #3c5143;
  transition: border-color .2s, background-color .2s;
}
.polymarket .metric:hover, .polymarket .scenario:hover {border-color: #71917b}
.polymarket .scroll, .polymarket details, .polymarket #exit {
  border: 1px solid #3c5143;
  border-radius: .8rem;
  background: #19231d;
}
.polymarket details {margin-top: 1rem;padding: .75rem 1rem}
.polymarket th {color: #aed0b8}
.polymarket td {font-variant-numeric: tabular-nums}
.polymarket td:nth-child(2) {font-family: ui-monospace, monospace;white-space: nowrap}
.polymarket tr:hover td {background: #223329}
#selection {overflow-wrap: anywhere}
.polymarket #results:not([hidden]), .polymarket #exit:not([hidden]) {animation: reveal .3s ease-out both}
@keyframes reveal {from {opacity: 0;transform: translateY(6px)} to {opacity: 1;transform: translateY(0)}}
@media (max-width: 700px) {
  .polymarket #wallet-form {grid-template-columns: minmax(0, 1fr);grid-template-areas: "label" "input" "hint" "actions"}
  .wallet-actions {margin-top: .2rem}
  .wallet-actions button:first-child {flex: 1}
}
@media (max-width: 640px) {
  #summary, #price-allocation {grid-template-columns: repeat(4, minmax(0, 1fr))}
  :is(#summary,#price-allocation) .metric {grid-column: span 2}
  :is(#summary,#price-allocation) .metric:last-child:nth-child(odd) {grid-column: 2 / span 2}
  #scenarios {grid-template-columns: minmax(0, 1fr)}
}
@media (prefers-reduced-motion: reduce) {
  .polymarket *, .polymarket #results:not([hidden]), .polymarket #exit:not([hidden]) {animation: none;transition: none}
}
.polymarket th .sort-column {
  min-height: 0;
  padding: .2rem .1rem;
  border: 0;
  border-radius: .2rem;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.polymarket th .sort-column:hover {transform: none;color: #e2f4e7}
.sort-column::after {content: " ↕";color: #8ba497}
th[aria-sort="ascending"] .sort-column::after {content: " ↑";color: #e2f4e7}
th[aria-sort="descending"] .sort-column::after {content: " ↓";color: #e2f4e7}
#cash-wallets {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:.55rem}
#cash-wallets dt {overflow-wrap:anywhere;font: .8125rem/1.45 ui-monospace, monospace}
#report-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 25rem);
  align-items: center;
  gap: .6rem;
  margin: .7rem 0;
}
#report-picker select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  padding: .4rem 2rem .4rem .65rem;
  appearance: none;
  border: 1px solid #46594b;
  border-radius: .55rem;
  background: linear-gradient(45deg, transparent 50%, #a4c5ae 50%) right 14px center / 5px 5px no-repeat,
              linear-gradient(135deg, #a4c5ae 50%, transparent 50%) right 9px center / 5px 5px no-repeat,
              #111914;
  color: #eef3ed;
  font: .8125rem ui-monospace, monospace;
  text-overflow: ellipsis;
}
#report-picker select:focus-visible {outline: 2px solid #aad8b5;outline-offset: 3px}

.position-tools {display:flex; flex-wrap:wrap; align-items:center; gap:.45rem .7rem; margin:1rem 0 .55rem}
.polymarket .position-tools h2 {margin:0 auto 0 0}
.position-tools select {border:1px solid #46594b; border-radius:.5rem; background:#111914; color:inherit; padding:.4rem .55rem; font:inherit}
.polymarket td.price-high {color:#bde2c5; font-weight:650}

#wallet-table th, #wallet-table td {white-space:nowrap}
#wallet-table :is(th,td):first-child {text-align:left}
#wallet-table td:first-child {font: .8125rem ui-monospace, monospace}
#wallet-table td:nth-child(2) {font-family:inherit}
.account-overview .notes {margin:.45rem 0 .8rem}

#wallet-table tfoot :is(th,td) {
  border-top: 1px solid #516859;
  background: #223128;
  color: #eef3ed;
  font-weight: 650;
}

.book-selection {display:flex;align-items:baseline;flex-wrap:wrap;gap:.3rem 1rem;margin:.45rem 0 .75rem}
.book-selection p {margin:0;flex:1 1 20rem}
#book-event-link {color:#bde2c5;text-underline-offset:.2em}
.book-controls {
  display:grid;
  grid-template-columns:minmax(0,9rem) max-content;
  grid-template-areas:"label label" "price refresh";
  align-items:stretch;
  gap:.3rem .65rem;
}
.book-controls label {grid-area:label}
.book-controls #limit {grid-area:price;width:100%;margin:0}
.book-controls #refresh-book {grid-area:refresh;margin:0}
#limit-note {margin:.4rem 0 .65rem}
@supports (grid-template-rows: subgrid) {
  @media (min-width:641px) {
    #scenarios {grid-template-rows:repeat(9,auto);row-gap:.3rem}
    #scenarios .scenario {display:grid;grid-row:span 9;grid-template-rows:subgrid}
    #scenarios .scenario h3 {margin:0 0 .15rem}
    #scenarios .scenario dl {grid-row:span 8;grid-template-rows:subgrid}
  }
}

.polymarket .scroll {min-width:0;overflow-x:auto}
.polymarket .scroll table {width:max-content;min-width:100%;table-layout:auto}
.polymarket .scroll :is(th,td) {padding:.42rem .6rem;line-height:1.4}
.polymarket .scroll th {max-width:none;font-size:.75rem}
.polymarket .scroll td {font-size:.8125rem}
.polymarket .scroll th .sort-column {display:inline-block;max-width:11rem;white-space:normal;text-align:inherit}
.polymarket :is(#positions,#closed-positions) td:first-child {width:16rem;max-width:20rem;overflow-wrap:anywhere}

.polymarket .scroll #wallet-table {width:100%;min-width:max-content}
.polymarket #wallet-table :is(th,td) {padding:.38rem .26rem}
.polymarket #wallet-table thead th .sort-column {max-width:4.5rem}
.polymarket #wallet-table thead .wallet-groups :is(th,td) {
  padding:.36rem .32rem;
  border-bottom:1px solid #42574a;
  background:#223128;
  color:#b8d2c1;
  text-align:center;
  font-weight:600;
}
#wallet-table .wallet-groups th + th,
#wallet-table tr:not(.wallet-groups) > :is(th,td):is(:nth-child(2),:nth-child(8),:nth-child(13)) {
  border-inline-start:1px solid #394a3f;
}
.polymarket #wallet-table tbody tr:nth-child(even) td {background:#1c2820}
.polymarket #wallet-table tbody tr:hover td {background:#26392e}
