:root {
  --bg: #fafafa; --fg: #1a1a1a; --muted: #6b6b6b; --line: #e3e3e3; --card: #fff;
  --accent: #2563eb; --pos: #15803d; --neg: #b91c1c; --warn: #b45309; --tag: #eef2ff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111214; --fg: #e8e8e8; --muted: #9a9a9a; --line: #2a2b2e; --card: #1a1b1e;
          --accent: #7aa2ff; --pos: #4ade80; --neg: #f87171; --warn: #fbbf24; --tag: #23263a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-size: 15px; line-height: 1.4; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1100px; margin: 0 auto; padding: 12px 14px 40px; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 16px; }
h1 { font-size: 22px; margin: 12px 0 8px; }
h2 { font-size: 17px; margin: 22px 0 8px; display: flex; align-items: center; gap: 10px; }
h2 small { color: var(--muted); font-weight: normal; font-size: 12px; }
.key, .count, .meta, .date, .muted { color: var(--muted); font-weight: normal; }
.count { font-size: 14px; margin-left: 4px; }
code { background: var(--tag); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line);
       background: var(--card); position: sticky; top: 0; z-index: 2; overflow-x: auto; white-space: nowrap; }
.top .brand { font-weight: 700; color: var(--fg); }
.top nav a { margin-right: 12px; font-size: 14px; }

input[type=search] { width: 100%; padding: 9px 12px; font-size: 16px; border: 1px solid var(--line);
                     border-radius: 8px; background: var(--card); color: var(--fg); margin: 6px 0 10px; }
.toolbar { display: flex; gap: 12px; align-items: center; }
.toolbar input { flex: 1; }
.toggle { font-size: 14px; white-space: nowrap; color: var(--muted); }

ul.lists, ul.companies { list-style: none; padding: 0; margin: 0; }
ul.lists li a, ul.companies li { display: block; padding: 10px 12px; border: 1px solid var(--line);
     border-radius: 10px; background: var(--card); margin-bottom: 6px; color: var(--fg); }
ul.lists li a code { margin-left: 8px; }
ul.companies li .meta { margin-left: 8px; font-size: 13px; }
ul.companies li.hide, tr.hide { display: none; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
thead th { background: var(--card); font-size: 12px; color: var(--muted); }
table.screen thead th { position: sticky; top: 41px; cursor: pointer; user-select: none; }
thead th.sorted::after { content: " \25BE"; }
thead th.sorted.asc::after { content: " \25B4"; }
td.name a { font-weight: 600; }
td.name .meta, td.name .opinion { display: block; font-size: 12px; }
td.name .opinion { color: var(--fg); opacity: .8; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.stale { opacity: .55; }
.tag { display: inline-block; background: var(--tag); padding: 2px 8px; border-radius: 999px; font-size: 12px; margin: 0 4px 4px 0; color: var(--fg); }
.tag.pos { background: var(--pos); color: #fff; } .tag.warn { background: var(--warn); color: #fff; }
blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 8px 8px 0; }
.scroll { overflow-x: auto; }
table.fin td, table.fin th { font-size: 13px; }
table.fin tr.q td, table.fin tr.ttm td { color: var(--muted); }
table.quotes th { font-weight: normal; color: var(--muted); width: 40%; }
table.quotes td.usd { color: var(--muted); }
table.qcmp thead th { text-align: right; } table.qcmp thead th:first-child { text-align: left; }
.small { font-size: 12px; }
.spark { vertical-align: middle; } .spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 6px; }
ul.sources, ul.notes { padding-left: 18px; font-size: 13px; }
ul.notes li { margin-bottom: 4px; }

/* phone: screener table becomes cards */
@media (max-width: 700px) {
  main { padding: 8px 10px 30px; }
  table.screen, table.screen tbody, table.screen tr { display: block; }
  table.screen thead { display: none; }
  table.screen tr { border: 1px solid var(--line); border-radius: 10px; background: var(--card);
                    margin-bottom: 8px; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
  table.screen tr.hide { display: none; }
  table.screen td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; font-size: 14px; }
  table.screen td.name { grid-column: 1 / -1; display: block; margin-bottom: 4px; }
  table.screen td.num::before { content: attr(data-label); color: var(--muted); font-size: 12px; margin-right: 8px; text-align: left; }
  .sortbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
  .sortbar button { flex: none; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
  .sortbar button.sorted { background: var(--accent); color: #fff; border-color: var(--accent); }
}
@media (min-width: 701px) { .sortbar { display: none; } }
