:root {
  --bg-deep: #060a12;
  --bg-primary: #0a1018;
  --bg-raised: #0f1622;
  --bg-card: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --green: #4aba70;
  --green-dim: rgba(74,186,112,0.14);
  --series-flag: #3fa863;
  --series-base: #5b8dd9;
  --orange: #e67e51;
  --text-primary: #e8ecf2;
  --text-secondary: #a3acbd;
  --text-muted: #8590a3;
  --mono: 'DM Mono', 'Courier New', monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --side: 224px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { background: var(--bg-deep); color: var(--text-primary); font-family: var(--sans); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text-primary); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 40; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: rgba(6,10,18,0.92); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { font-family: var(--mono); font-size: 13px; letter-spacing: 4px; color: var(--green); text-transform: uppercase; white-space: nowrap; }
.pill { font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-secondary);
  border: 1px solid var(--border-strong); border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .period { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidenav { border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.sidenav .navlabel { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); padding: 0 10px 8px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.sidenav a .num { font-family: var(--mono); font-size: 11px; color: var(--text-muted); width: 16px; }
.sidenav a:hover { background: var(--bg-card); color: var(--text-primary); text-decoration: none; }
.sidenav a.active { background: var(--green-dim); color: var(--text-primary); }
.sidenav a.active .num { color: var(--green); }
.sidenav .sidenote { margin-top: 22px; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

main { min-width: 0; padding: 26px 32px 0; }
.view { max-width: 1120px; }
.footer { max-width: 1120px; margin-top: 40px; padding: 18px 0 30px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* Headings */
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--green); margin-bottom: 8px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.15; margin-bottom: 6px; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.lede { color: var(--text-secondary); max-width: 780px; margin-bottom: 4px; }
.muted { color: var(--text-muted); font-size: 12.5px; }
.sec { margin-top: 26px; }
.head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }

/* Cards and tiles */
.panel { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; position: relative; }
.panel + .panel { margin-top: 16px; }
.panel .sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .l { font-size: 12px; color: var(--text-muted); }
.tile .v { font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.tile .d { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.8px; padding: 3px 8px;
  border-radius: 4px; border: 1px solid; text-transform: uppercase; white-space: nowrap; line-height: 1.4; }
.badge.lock { color: var(--text-secondary); border-color: var(--border-strong); }
.badge.lock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.badge.flag { color: var(--text-primary); border-color: var(--series-flag); }
.badge.flag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--series-flag); }
.badge.ok { color: var(--text-muted); border-color: var(--border); }
.badge.hit { color: var(--text-primary); border-color: var(--orange); }
.badge.hit::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.badge.miss { color: var(--text-muted); border-color: var(--border-strong); }
.badge.sample { color: var(--green); border-color: var(--green); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 12px; }
.controls .grow { flex: 1 1 180px; }
input[type=text], input[type=email], select, textarea { background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: 6px; padding: 8px 10px; outline: none; }
input[type=text]:focus, select:focus, textarea:focus, input[type=email]:focus { border-color: var(--green); }
select { padding-right: 26px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { background: transparent; border: 0; padding: 7px 12px; color: var(--text-secondary); cursor: pointer; font-size: 13px; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--green-dim); color: var(--text-primary); }
.btn { background: var(--green); color: #06120b; border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-strong); font-weight: 500; }
.count { font-size: 12.5px; color: var(--text-muted); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-primary); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 400; white-space: nowrap; background: var(--bg-primary); }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: rgba(255,255,255,0.025); }
.tk { font-family: var(--mono); font-weight: 500; color: var(--text-primary); font-size: 13px; }
.nm { display: block; color: var(--text-muted); font-size: 12px; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more { display: block; margin: 12px auto 0; }

/* Inline bars */
.ibar { display: inline-flex; align-items: center; gap: 8px; }
.ibar .track { position: relative; width: 76px; height: 10px; }
.ibar .track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,0.22); }
.ibar .fill { position: absolute; top: 2px; height: 6px; background: var(--series-base); }
.ibar .fill.pos { left: calc(50% + 1px); border-radius: 0 3px 3px 0; }
.ibar .fill.neg { right: calc(50% + 1px); border-radius: 3px 0 0 3px; }
.ibar .fill.f { background: var(--series-flag); }
.ibar .val { font-family: var(--mono); font-size: 12px; color: var(--text-primary); width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* Rule box */
.rule { border-left: 2px solid var(--green); padding: 2px 0 2px 14px; margin: 14px 0; color: var(--text-secondary); font-size: 13px; max-width: 900px; }
.rule b { color: var(--text-primary); font-weight: 600; }
.limit { border-left: 2px solid var(--orange); padding: 2px 0 2px 14px; margin-top: 10px; color: var(--text-secondary); font-size: 12.5px; }
.limit b { color: var(--text-primary); font-weight: 600; }
.caption { font-size: 13px; color: var(--text-secondary); margin-top: 8px; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-secondary); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; width: 16px; border-radius: 1px; vertical-align: 3px; }
.legend i.tick { width: 2px; height: 12px; border-radius: 1px; background: var(--text-secondary); vertical-align: -2px; }
.legend i.dot { border-radius: 50%; }
.legend i.band { background: rgba(255,255,255,0.12); width: 18px; }
svg text { font-family: var(--sans); }
#tip { position: fixed; z-index: 100; pointer-events: none; background: #141c28; border: 1px solid var(--border-strong); border-radius: 6px; padding: 8px 10px;
  font-size: 12px; color: var(--text-primary); display: none; max-width: 300px; box-shadow: 0 8px 22px rgba(0,0,0,0.45); line-height: 1.45; }
#tip b { font-weight: 600; }
#tip .m { color: var(--text-secondary); }

/* Company view */
.co-head { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; justify-content: space-between; }
.co-head .meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--text-secondary); font-size: 13px; margin-top: 6px; }
.co-head .meta span b { color: var(--text-primary); font-weight: 500; }
.back { font-size: 13px; display: inline-block; margin-bottom: 12px; }
.reading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.reading .big { font-size: 30px; font-weight: 600; line-height: 1.1; }
.reading .row { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--text-secondary); }
.placeholder { border: 1px dashed var(--border-strong); border-radius: 8px; padding: 14px 16px; color: var(--text-secondary); font-size: 13px; background: rgba(255,255,255,0.015); }
.placeholder b { color: var(--text-primary); }
.ph-list { display: grid; gap: 6px; margin-top: 10px; }
.ph-item { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12.5px; }
.ph-item .lab { color: var(--text-secondary); }
.ph-item .bar { height: 10px; border-radius: 5px; background: repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0 6px, rgba(255,255,255,0.02) 6px 12px); }
.other-filings a { margin-right: 10px; font-family: var(--mono); font-size: 12px; }

/* Evidence */
.ev-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; margin-top: 16px; align-items: start; }
.ev-list { display: grid; gap: 4px; max-height: 640px; overflow-y: auto; padding-right: 4px; }
.ev-list button { text-align: left; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 7px 10px; cursor: pointer; color: var(--text-secondary); }
.ev-list button:hover { background: var(--bg-card); }
.ev-list button.on { background: var(--green-dim); border-color: rgba(74,186,112,0.35); color: var(--text-primary); }
.ev-list .t { font-family: var(--mono); font-size: 12.5px; color: var(--text-primary); }
.ev-list .s { font-size: 11.5px; color: var(--text-muted); display: block; }
.group { margin-bottom: 20px; }
.group h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.group h3 .c { font-family: var(--mono); font-size: 12px; color: var(--text-muted); font-weight: 400; }
.quote { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.quote .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.5px; color: var(--text-secondary); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 7px; }
.tag.dir::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--text-muted); }
.quote p { color: var(--text-primary); font-size: 14px; line-height: 1.6; }
.quote p::before { content: "\201C"; color: var(--text-muted); }
.quote p::after { content: "\201D"; color: var(--text-muted); }
.quote .ver { margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }

/* Sector map */
td.heat { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text-primary); }
.scale { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.scale span.sw { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }

/* Portfolio */
textarea { width: 100%; min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.reason { font-size: 12.5px; color: var(--text-secondary); max-width: 440px; }
.reason b { color: var(--text-primary); font-weight: 500; }

/* Alerts */
.form-grid { display: grid; gap: 16px; }
.field label.h { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--green); width: 15px; height: 15px; }
.alert-card { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-raised); overflow: hidden; }
.alert-card .ah { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.alert-card .ab { padding: 16px; }
.alert-card .ab h3 { font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; margin-top: 12px; }
.kv .k { color: var(--text-muted); }
.kv .v { color: var(--text-primary); }
pre.json { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--text-secondary);
  overflow-x: auto; max-width: 100%; white-space: pre; }
.toast { margin-top: 10px; font-size: 12.5px; color: var(--green); min-height: 18px; }
.preview-n { font-size: 28px; font-weight: 600; }

/* Responsive */
@media (max-width: 980px) {
  .grid3 { grid-template-columns: 1fr; }
  .ev-layout { grid-template-columns: 1fr; }
  .ev-list { max-height: 220px; }
}
@media (max-width: 820px) {
  :root { --side: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: sticky; top: 56px; z-index: 30; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px 8px;
    display: flex; overflow-x: auto; overflow-y: hidden; gap: 2px; background: rgba(6,10,18,0.96); scrollbar-width: none; }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav .navlabel, .sidenav .sidenote { display: none; }
  .sidenav a { white-space: nowrap; padding: 7px 10px; font-size: 13px; }
  .sidenav a .num { display: none; }
  main { padding: 18px 16px 0; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar .period { display: none; }
  h1 { font-size: 28px; }
  .hide-m { display: none; }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
  .ph-item { grid-template-columns: 130px minmax(0, 1fr); }
  .panel { padding: 16px 14px; }
}
@media (max-width: 520px) {
  .hide-s { display: none; }
  .ibar .track { width: 60px; }
  .ibar .val { width: 38px; }
  td, th { padding: 8px 8px; }
  .nm { max-width: 140px; }
}
.only-s { display: none !important; }
@media (max-width: 520px) { .only-s { display: flex !important; margin-top: 4px; } }

.grid2 > *, .grid3 > * { min-width: 0; }
.grid2 > .panel + .panel, .grid3 > .panel + .panel { margin-top: 0; }
table.heatmap th { white-space: normal; vertical-align: bottom; line-height: 1.35; }
table.heatmap td, table.heatmap th { padding-left: 10px; padding-right: 10px; }
table.heatmap .nm { max-width: 200px; }

.only-s-i { display: none; }
@media (max-width: 520px) { .only-s-i { display: inline; } .ibar .track { width: 46px; } .ibar { gap: 4px; } .nm { max-width: 120px; } }
table.watch td, table.watch th { padding-left: 10px; padding-right: 10px; }

.backlink{font-family:var(--mono, 'DM Mono', monospace);font-size:12px;color:#4aba70;border:1px solid #4aba70;border-radius:4px;padding:6px 12px;margin-left:14px;text-decoration:none;white-space:nowrap}
.backlink:hover{background:rgba(74,186,112,0.14)}
@media (max-width:820px){.topbar .period{display:none}.backlink{margin-left:auto}}
@media (max-width:600px){.topbar{height:auto;flex-wrap:wrap;padding:10px 16px;row-gap:8px}.topbar .spacer{display:none}.backlink{margin-left:0}.sidenav{top:0}}
