/* Insider Trades: one family, few colors, dense tables. */
:root {
  --ink: #1b1f24;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --link: #0b57a4;
  --buy-bg: #e3f5e8;   /* light green rows */
  --buy-bg-2: #cdeed7;
  --sell-bg: #fdeaea;  /* light red rows */
  --sell-bg-2: #f9d3d3;
  --oe-bg: #fff5cc;    /* light yellow rows */
  --oe-bg-2: #ffeaa3;
  --buy: #008300;      /* chart marks */
  --sell: #e34948;
  --price: #2a78d6;    /* price line */
  --focus: #0b57a4;
  --radius: 6px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-family: var(--font); color: var(--ink); background: var(--surface); font-size: 14px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a.quiet { color: inherit; }
a.quiet:hover { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.warn { color: #9a3412; background: #fff1e6; padding: 6px 10px; border-radius: var(--radius); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
button, input, select { font: inherit; color: inherit; }

/* ---- header ---- */
.top { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.top-row { display: flex; align-items: center; gap: 18px; height: 52px; }
.brand { font-weight: 600; font-size: 17px; color: var(--ink); letter-spacing: -0.02em; white-space: nowrap; }
.brand span { color: var(--buy); }
.brand:hover { text-decoration: none; }
.search { display: flex; gap: 0; flex: 0 1 340px; }
.search input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--surface); }
.search button, .hero-search button, .filters button { height: 34px; padding: 0 12px; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-weight: 500; }
.search button:hover, .hero-search button:hover, .filters button:hover { background: #000; }
.menu { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.menu > a, .menu summary { padding: 6px 10px; border-radius: var(--radius); color: var(--ink); cursor: pointer; list-style: none; user-select: none; white-space: nowrap; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; display: inline-block; margin-left: 6px; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: translateY(-2px) rotate(45deg); }
.menu > a:hover, .menu summary:hover, .dd[open] summary { background: var(--surface-2); text-decoration: none; }
.dd { position: relative; }
.dd-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(27, 31, 36, 0.10); padding: 6px; display: grid; }
.dd-panel a { padding: 7px 10px; border-radius: 4px; color: var(--ink); }
.dd-panel a:hover { background: var(--surface-2); text-decoration: none; }

/* ---- home hero ---- */
.hero { padding: 40px 0 20px; max-width: 760px; }
.hero h1 { font-size: 30px; letter-spacing: -0.02em; }
.lede { margin-top: 10px; font-size: 15px; color: var(--ink-2); max-width: 62ch; }
.hero-search { display: flex; margin-top: 18px; max-width: 420px; }
.hero-search input { flex: 1; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); font-size: 15px; }
.hero-search button { height: 40px; }
.tracked { margin-top: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.tk { font-weight: 600; letter-spacing: 0.01em; }

/* ---- blocks ---- */
.block { margin: 26px 0 34px; }
.block-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.block-head .muted { max-width: 70ch; }
.block-head .more { margin-left: auto; white-space: nowrap; }
.count { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 4px; }
.tints { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--ink-2); margin: 6px 0 12px; font-size: 13px; }
.block-head .tints { margin: 0 0 0 auto; }
.sw::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0,0,0,.08); }
.sw.buy::before { background: var(--buy-bg-2); }
.sw.sell::before { background: var(--sell-bg-2); }
.sw.oe::before { background: var(--oe-bg-2); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; }
.tabs a { padding: 5px 10px; border-radius: var(--radius); color: var(--ink); border: 1px solid var(--line); }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a:hover { text-decoration: none; border-color: var(--line-2); }

/* ---- company header ---- */
.company-head { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; padding: 26px 0 8px; }
.company-head h1 { font-size: 22px; }
.tk-big { font-size: 26px; font-weight: 600; margin-right: 6px; }
.tiles { display: flex; gap: 10px; margin: 0 0 0 auto; flex-wrap: wrap; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 190px; }
.tile.buy { background: var(--buy-bg); border-color: var(--buy-bg-2); }
.tile.sell { background: var(--sell-bg); border-color: var(--sell-bg-2); }
.tile dt { color: var(--ink-2); font-size: 12px; }
.tile dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.tile small { color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 24px; margin: 18px 0 6px; align-items: start; }
.side h2 { margin-bottom: 8px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
thead th { font-weight: 500; color: var(--ink-2); font-size: 12px; background: var(--surface-2); position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line-2); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th.sorted-asc::after, th.sorted-desc::after { content: ""; display: inline-block; margin-left: 5px; border: 4px solid transparent; vertical-align: 1px; }
th.sorted-asc::after { border-bottom-color: var(--ink); border-top: 0; }
th.sorted-desc::after { border-top-color: var(--ink); border-bottom: 0; }
.num { text-align: right; }
.abbr { border-bottom: 1px dotted var(--line-2); cursor: help; }
.trades { font-size: 13px; }
.trades td { line-height: 1.35; }
.trades tr.buy td { background: var(--buy-bg); }
.trades tr.sell td { background: var(--sell-bg); }
.trades tr.oe td { background: var(--oe-bg); }
.trades tbody tr:hover td { filter: brightness(0.965); }
.trades .c-x { width: 44px; white-space: nowrap; }
.flag { display: inline-block; font-size: 10.5px; font-weight: 600; line-height: 15px; padding: 0 4px; border-radius: 3px; background: rgba(27, 31, 36, 0.08); color: var(--ink-2); margin-right: 2px; cursor: help; }
.trades .co, .trades .ins { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.trades .ttl { max-width: 190px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.trades .typ { white-space: nowrap; }
.trades .val { font-weight: 500; }
tr.empty td { color: var(--muted); padding: 18px 10px; white-space: normal; }
.mini { font-size: 13px; }
.mini th { font-size: 12px; }
.mini.wide td { white-space: normal; }
.mini.wide td.nw { white-space: nowrap; }
.mini .fn { max-width: 380px; color: var(--ink-2); font-size: 12px; }
.mini .ttl { color: var(--ink-2); }
.mini tr.buy td { background: var(--buy-bg); }
.mini tr.sell td { background: var(--sell-bg); }
.mini tr.oe td { background: var(--oe-bg); }
.mini tr.warn td { background: #fff7ed; }
.legend-table .k { width: 200px; font-weight: 500; }
.legend-table td { white-space: normal; }
.table-tools { display: flex; justify-content: flex-end; gap: 8px; margin: 8px 0; }
.quick-select { height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.quick { height: 30px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); width: 260px; max-width: 100%; }
.hbar { display: inline-flex; width: 180px; height: 10px; border-radius: 2px; overflow: hidden; gap: 2px; }
.hbar i { display: block; height: 100%; }
.hbar .buy { background: var(--buy); }
.hbar .sell { background: var(--sell); }
.bar-col { width: 200px; }

/* ---- filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 10px; font-size: 13px; }
.filters label { display: flex; flex-direction: column; gap: 3px; color: var(--ink-2); }
.filters .unit { color: var(--muted); }
.filters select, .filters input[type=number] { height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.filters input.short { width: 90px; }
.filters .check { flex-direction: row; align-items: center; gap: 6px; height: 32px; }
.filters button { border-radius: var(--radius); height: 32px; }
.filters .reset { color: var(--muted); align-self: center; }
fieldset.chips { border: 0; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
fieldset.chips legend { padding: 0; color: var(--ink-2); margin-bottom: 3px; font-size: 13px; }
.filters .chip { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; height: 32px; padding: 0 10px 0 7px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); cursor: pointer; color: var(--ink); white-space: nowrap; }
.chip span { font-weight: 600; }
.chip input { margin: 0; accent-color: var(--ink); }
.chip:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip-buy:has(input:checked) { background: var(--buy); border-color: var(--buy); }
.chip-sell:has(input:checked) { background: var(--sell); border-color: var(--sell); }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 14px 0; color: var(--muted); }

/* ---- charts ---- */
.chart { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; position: relative; }
.chart figcaption { margin-bottom: 4px; }
.chart-legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.key::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.key.buy::before { background: var(--buy); }
.key.sell::before { background: var(--sell); }
.linkish { margin-left: auto; background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font-size: 12px; }
.linkish:hover { text-decoration: underline; }
.chart-body svg { width: 100%; height: auto; display: block; }
.chart-body text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart-body .grid { stroke: var(--line); stroke-width: 1; }
.chart-body .zero { stroke: var(--line-2); stroke-width: 1; }
.chart-body .bar.buy { fill: var(--buy); }
.chart-body .bar.sell { fill: var(--sell); }
.pchart .bar.buy { fill: var(--buy); }
.pchart .bar.sell { fill: var(--sell); }
.chart-body .hit { fill: transparent; }
.chart-body .hit:hover + .bar-group .bar, .chart-body .col:hover .bar { opacity: .8; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 4px; white-space: nowrap; z-index: 5; }
.chart-tip b { font-weight: 600; }
.chart-table { margin-top: 8px; font-size: 12px; }

/* ---- price chart ---- */
.pchart-block { margin-top: 18px; }
.pchart .chart-legend { flex-wrap: wrap; }
.key.price::before { background: var(--price); height: 2px; width: 14px; border-radius: 1px; vertical-align: 3px; }
.key.dot::before { border-radius: 50%; }
.ranges { margin-left: auto; display: inline-flex; gap: 2px; }
.ranges button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; padding: 2px 8px; border-radius: 4px; cursor: pointer; }
.ranges button:hover { border-color: var(--line-2); color: var(--ink); }
.ranges button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pchart .line { fill: none; stroke: var(--price); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pchart .mk { stroke: var(--surface); stroke-width: 2; }
.pchart .mk.buy { fill: var(--buy); }
.pchart .mk.sell { fill: var(--sell); }
.pchart .xhair { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.pchart .hdot { fill: var(--price); stroke: var(--surface); stroke-width: 2; }
.pchart .panel-label { font-size: 11px; fill: var(--muted); }
.pnote { font-size: 12px; margin-top: 6px; }
/* TradingView slot: fixed height so nothing shifts when the widget arrives; it fades in when ready */
.tv-slot { position: relative; height: 380px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.tv-slot .tv-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; opacity: 0; transition: opacity .25s ease; }
.tv-slot .tv-frame.on { opacity: 1; }
.tv-slot.ready { background: var(--surface); }
.tv-wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.tv-slot.ready .tv-wait { display: none; }
.tv-credit { font-size: 11px; color: var(--muted); text-align: right; margin: 2px 0 4px; }
@media (prefers-reduced-motion: reduce) { .tv-slot .tv-frame { transition: none; } }
.chart-tip .muted-tip { color: #c9ced6; }

/* ---- prose ---- */
.prose { max-width: 900px; }
.prose h1 { margin-bottom: 8px; }
.prose h2 { margin: 22px 0 8px; }
.prose p { max-width: 70ch; }
.prose p + p { margin-top: 8px; }
.results { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }

/* ---- footer ---- */
.foot { margin: 40px auto 30px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot p + p { margin-top: 4px; }

@media (max-width: 860px) {
  .top-row { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 10px; }
  .search { flex: 1 1 100%; order: 3; }
  .menu { margin-left: auto; }
  .two-col { grid-template-columns: 1fr; }
  .tiles { margin-left: 0; }
  .hero { padding-top: 24px; }
  .hero h1 { font-size: 24px; }
  .block-head .tints { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
