:root {
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  color: #18251e;
  background: #fff;
  font-synthesis: none;
  --green: #217346;
  --line: #dce2dd;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; border-radius: 4px; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
[hidden] { display: none !important; }
main { height: 100dvh; display: flex; flex-direction: column; background: white; }
.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title pause" "search columns" "balance balance";
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: #f7faf8;
  border-bottom: 1px solid var(--line);
  flex: none;
}
h1 { grid-area: title; font-size: 15px; color: var(--green); font-weight: 600; margin: 0; white-space: nowrap; }
.search { grid-area: search; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 8px 10px; background: white; border: 1px solid #d9e0da; border-radius: 4px; color: #829087; }
.search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; font-size: 16px; color: #293d30; background: none; }
.search:focus-within { border-color: #6a9a7a; }
.search kbd { display: none; }
.tool-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border: 1px solid transparent; border-radius: 4px; color: inherit; background: transparent; text-decoration: none; font-size: 13px; white-space: nowrap; }
.tool-button:hover:not(:disabled) { background: #edf3ee; border-color: #d9e3dc; }
.tool-button[aria-pressed=true] { background: #e7f0e9; border-color: #b8d0be; }
#pause { grid-area: pause; padding: 8px 16px; background: var(--green); border-color: var(--green); color: white; font-weight: 600; }
#pause:hover { background: #195c38; border-color: #195c38; }
#pause[aria-pressed=true] { background: #e3eee6; border-color: #8eb69a; color: #1d5c37; box-shadow: inset 0 1px 2px #173e2520; }
#pause[aria-pressed=true]:hover { background: #d8e8dd; }
#columns { grid-area: columns; border-color: #d2ded5; }
.balance-filters { grid-area: balance; display: flex; min-width: 0; overflow: hidden; border: 1px solid #cbdacf; border-radius: 4px; background: white; }
.balance-filters button { flex: 1; min-height: 44px; padding: 6px 10px; border: 0; border-right: 1px solid #dce6df; border-radius: 0; background: transparent; color: #526b5b; white-space: nowrap; font-size: 13px; }
.balance-filters button:last-child { border-right: 0; }
.balance-filters button:hover { background: #f0f6f2; }
.balance-filters button[aria-pressed=true] { background: #dfede3; color: #1c6038; font-weight: 600; box-shadow: inset 0 -2px #43835a; }
.balance-filters button:focus-visible { outline-offset: -3px; }
#clear-filters { display: none; }
#clear-filters:not(:disabled) { display: inline-flex; grid-column: 1 / -1; grid-row: 4; justify-self: start; min-height: 44px; }
.toolbar-spacer { flex: 1; }
.notice { flex: none; padding: 8px 12px; background: #fff9e8; color: #826820; font-size: 12px; border-bottom: 1px solid #eddfb6; line-height: 1.5; }
.sheet { overflow: auto; overscroll-behavior: contain; position: relative; min-height: 0; flex: 1; scrollbar-color: #c9d4cc #f3f6f4; scrollbar-width: thin; }
table { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; font-variant-numeric: tabular-nums lining-nums; background: white; }
.detail-column { display: none; }
thead { position: sticky; top: 0; z-index: 5; background: white; }
.headers th { position: relative; height: 78px; padding: 0 4px 32px; border-right: 1px solid #e0e5e1; border-bottom: 1px solid #a6b7ab; text-align: center; background: #f5f8f6; font-size: 13px; font-weight: 600; line-height: 1.3; }
.headers th:last-child { border-right: 0; }
.headers th[data-key=symbol] { width: 22%; position: sticky; left: 0; z-index: 6; }
.headers th[data-key=os2] { width: 22%; }
.headers th[data-key=ask] { width: 28%; }
.headers th[data-key=balance] { width: 28%; background: #e8f1eb; }
.sort-button { width: 100%; min-height: 44px; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.sort-button:hover { color: var(--green); }
.sort-mark { font-size: 11px; color: #48805a; padding-left: 3px; }
.filter-button { position: absolute; bottom: 2px; right: calc(50% - 20px); width: 40px; height: 30px; padding: 0; border: 1px solid #d3ded6; background: #fff; font-size: 13px; line-height: 26px; color: #6b776e; border-radius: 3px; }
.filter-button:hover, .filter-button.active { background: #dfeddf; border-color: #6b9b79; color: #217346; }
.number-header { padding: 0 !important; }
tbody td { height: 44px; padding: 8px 7px; border-right: 1px solid #e9ede9; border-bottom: 1px solid #edf0ed; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; color: #101c14; font-size: 14px; line-height: 22px; }
tbody td:last-child { border-right: 0; }
tbody tr:hover td { background-color: #f4f9f5; }
tbody td.symbol { position: sticky; left: 0; z-index: 2; text-align: left; padding-left: max(9px, env(safe-area-inset-left)); font-weight: 600; background: white; box-shadow: 1px 0 #dce2dd; }
td.symbol a { color: #142c1c; text-decoration: none; }
td.symbol a:hover { color: #217346; text-decoration: underline; }
.rank-cell { color: #89958c; background: #fafbfa; text-align: center; font-size: 12px; padding-inline: 3px; }
.missing { color: #b5bfb8 !important; }
.balance-cell { font-weight: 700; border-left: 1px solid #d7e3db; }
.balance-cell.positive { color: #16663d; background-color: #eff7f1; }
.balance-cell.negative { color: #a03631; background-color: #fcf1ef; }
.balance-cell.above-threshold { box-shadow: inset 3px 0 #69a17b; }
.balance-cutoff td { border-top: 2px solid #69a17b; }
.balance-cell.stale-value { background-color: #f4f6f4; }
.balance-cell.stale-value.above-threshold { box-shadow: inset 3px 0 #b6c4bb; }
.balance-cell.missing { font-weight: 400; }
.stale-value { color: #68766d !important; }
.target-marker::before { content: ""; position: absolute; left: 1px; top: 1px; border-top: 4px solid #32984a; border-right: 4px solid transparent; }
.selected-cell { outline: 2px solid #27874c; outline-offset: -2px; background: #f3f9f4 !important; }
.sheet.show-all table { min-width: 820px; }
.sheet.show-all .detail-column { display: table-cell; }
.sheet.show-all .headers th[data-key] { width: auto; }
.sheet.show-all .number-header { position: sticky; left: 0; z-index: 7; width: 32px; }
.sheet.show-all .headers th[data-key=symbol] { width: 84px; left: 32px; }
.sheet.show-all td.symbol { left: 32px; }
.sheet.show-all .rank-cell { position: sticky; left: 0; z-index: 3; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 60px 20px; color: #8c9a90; font-size: 13px; background: white; text-align: center; }
.empty-state strong { color: #5b6d61; font-size: 15px; font-weight: 500; }
.empty-grid { font-size: 36px; color: #b3c8b9; line-height: 1; margin-bottom: 7px; }
.status-bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 36px; padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: #f4f7f5; color: #6d8072; font-size: 11px; border-top: 1px solid #dce4de; white-space: nowrap; }
.status-bar .toolbar-spacer, #updated-at { display: none; }
#queue-status { margin-left: auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.connection-pill { display: flex; align-items: center; gap: 6px; }
.status-dot { width: 5px; height: 5px; background: #b9c7bd; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.connection-pill.live .status-dot { background: #318650; }
.connection-pill.error .status-dot { background: #bc7b32; }
.filter-menu { position: fixed; z-index: 20; min-width: 225px; max-width: min(290px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; background: white; border: 1px solid #cbd8ce; border-radius: 5px; box-shadow: 0 7px 28px #18362426; padding: 6px; font-size: 14px; }
.filter-menu h3 { font-size: 12px; padding: 8px; margin: 0; color: #738077; font-weight: 600; }
.filter-menu button { display: block; width: 100%; min-height: 44px; padding: 10px; text-align: left; border: 0; background: white; border-radius: 3px; font-size: 14px; }
.filter-menu button:hover { background: #edf4ef; }
.filter-fields { padding: 8px; border-top: 1px solid #e4eae6; margin-top: 4px; }
.filter-fields label { display: block; color: #6a7c70; font-size: 12px; margin-bottom: 5px; }
.filter-fields input { width: 100%; min-height: 44px; border: 1px solid #cfdad2; padding: 8px; font-size: 16px; margin-bottom: 8px; }
.filter-menu .apply-filter { background: #217346; color: white; text-align: center; margin-bottom: 4px; }
.filter-menu .apply-filter:hover { background: #195f39; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 900px) {
  .toolbar { display: flex; gap: 8px; min-height: 52px; padding: 6px 16px; }
  h1 { margin-right: 12px; }
  .search { width: 260px; min-height: 38px; padding: 6px 9px; }
  .search input { font-size: 14px; }
  .search kbd { display: block; border: 1px solid #e2e7e3; border-radius: 2px; padding: 0 4px; font: 10px Calibri, sans-serif; color: #a6b0a9; }
  .toolbar .tool-button { min-height: 38px; }
  .balance-filters { flex: none; }
  .balance-filters button { min-height: 36px; padding: 6px 12px; }
  #columns { display: none; }
  #clear-filters, #clear-filters:not(:disabled) { display: inline-flex; min-height: 38px; }
  #pause { margin-left: auto; }
  table, .sheet.show-all table { min-width: 800px; }
  .detail-column { display: table-cell; }
  .headers th, .sheet.show-all .headers th { height: 58px; padding: 0 8px 20px; font-size: 14px; }
  .headers th[data-key], .sheet.show-all .headers th[data-key] { width: auto; }
  .headers .number-header, .sheet.show-all .number-header { position: sticky; left: 0; width: 36px; z-index: 7; }
  .headers th[data-key=symbol], .sheet.show-all .headers th[data-key=symbol] { width: 96px; left: 36px; }
  .sort-button { min-height: 32px; }
  .filter-button { right: 6px; bottom: 3px; width: 24px; height: 18px; font-size: 11px; line-height: 15px; }
  tbody td { height: 36px; padding: 6px 14px 6px 9px; font-size: 15px; }
  tbody td.symbol, .sheet.show-all td.symbol { left: 36px; padding-left: 14px; }
  .rank-cell { position: sticky; left: 0; z-index: 3; }
  .status-bar { flex-wrap: nowrap; padding: 8px 16px; }
  .status-bar .toolbar-spacer, #updated-at { display: block; }
  #updated-at { color: #8b988f; }
}
