:root { --primary: #1F3A5F; --accent: #C8A951; --bg: #f4f6f9; --line: #dde2e8; --text: #1f2328; --muted: #6b7280; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 13.5px; color: var(--text); background: var(--bg); }
a { color: var(--primary); }
.topnav { display: flex; align-items: center; gap: 18px; background: var(--primary); color: #fff; padding: 0 20px; height: 46px; }
.topnav a { color: #e8edf3; text-decoration: none; padding: 6px 2px; border-bottom: 2px solid transparent; }
.topnav a.active { border-bottom-color: var(--accent); color: #fff; }
.topnav .brand { font-weight: 700; font-size: 15px; color: #fff; margin-right: 12px; }
.topnav .brand span { font-weight: 400; opacity: .8; margin-left: 6px; }
.topnav .right { margin-left: auto; }
.container { max-width: 1400px; margin: 18px auto; padding: 0 20px; }
.foot { text-align: center; color: var(--muted); font-size: 11px; padding: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; }
.card.compact { padding: 10px 14px; }
.card.narrow { max-width: 420px; margin: 60px auto; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.side { flex: 0 0 340px; }
h2 { margin: 0 0 12px; font-size: 19px; color: var(--primary); }
h3 { margin: 14px 0 8px; font-size: 15px; color: var(--primary); }
h4 { margin: 14px 0 6px; font-size: 13px; color: var(--primary); }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; } .nowrap { white-space: nowrap; }
.err { color: #b42318; } .neg { color: #b42318; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.flash.err { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.flash ul { margin: 6px 0 0 18px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); border-bottom: 2px solid var(--line); padding: 7px 8px; background: #fafbfc; }
table.grid td { padding: 6px 8px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
table.grid tr.total td { font-weight: 600; border-top: 2px solid var(--primary); background: #f5f7fa; }
table.grid tr.group td { font-weight: 600; background: #eef2f7; color: var(--primary); }
table.grid tr.sub td:first-child { padding-left: 22px; }
table.grid tr.dim td { color: #a0a6ad; }
table.grid tfoot td { font-weight: 600; border-top: 2px solid var(--primary); }
th.r, td.r { text-align: right; white-space: nowrap; } th.c, td.c { text-align: center; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #f0f5fb; }
tr.conf-low td:nth-child(12) { background: #fff1f0; }
.bar { height: 10px; background: var(--primary); border-radius: 2px; }
.kpis { display: flex; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.kpi { flex: 1; min-width: 150px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px; }
.kpi .v { font-size: 20px; font-weight: 600; color: var(--primary); }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { background: none; border: none; padding: 9px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--primary); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: #e5e7eb; color: #374151; font-weight: 600; }
.badge.high, .badge.done, .badge.info { background: #d1fadf; color: #067647; }
.badge.medium, .badge.warning, .badge.running { background: #fef0c7; color: #b54708; }
.badge.low, .badge.error, .badge.failed { background: #fee4e2; color: #b42318; }
.chip { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 10.5px; margin: 1px 2px 1px 0; background: #eef1f4; color: #374151; }
.chip.error { background: #fee4e2; color: #b42318; } .chip.warning { background: #fef0c7; color: #b54708; }
.btn { display: inline-block; padding: 7px 12px; border: 1px solid #c9d1da; background: #fff; color: var(--text); border-radius: 5px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f3f5f8; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #b42318; border-color: #f4b6b1; } .btn.small { padding: 4px 9px; font-size: 12px; }
button.link { background: none; border: none; color: #e8edf3; font: inherit; cursor: pointer; }
form.inline, .inline { display: inline-block; margin: 0; }
label { display: block; margin-bottom: 10px; font-size: 12.5px; color: #374151; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 3px; padding: 6px 8px; border: 1px solid #c9d1da; border-radius: 4px; font: inherit; }
label.check { display: flex; gap: 8px; align-items: center; } label.check input { width: auto; margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; } .span2 { grid-column: span 2; }
.color-row { display: flex; align-items: center; gap: 8px; } .color-row input { width: 60px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; } .facts dt { color: var(--muted); font-size: 12px; } .facts dd { margin: 0; }
.progress { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 8px 0; } .progress div { height: 100%; background: var(--accent); transition: width .4s; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-details { position: relative; } .inline-details summary { list-style: none; } .popform { position: absolute; right: 0; top: 30px; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px; width: 320px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.matrix td .pc { display: inline; }
.drawer { position: fixed; top: 0; right: 0; width: 560px; max-width: 95vw; height: 100vh; background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12); z-index: 20; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.drawer-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 10px; }
.drawer-body { padding: 14px 16px; overflow: auto; flex: 1; }
.notice { background: #f5f7fa; border-left: 3px solid var(--accent); padding: 8px 10px; margin-bottom: 12px; font-size: 12.5px; }
fieldset.weights { border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; }
fieldset.weights legend { font-size: 12px; color: var(--primary); font-weight: 600; }
fieldset.weights label.w { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0; font-size: 11.5px; }
fieldset.weights label.w input { width: 62px; margin: 0; padding: 3px 5px; }
#wsum.ok { background: #d1fadf; color: #067647; } #wsum.bad { background: #fee4e2; color: #b42318; }
.mapgrid { display: grid; grid-template-columns: 200px 1fr; gap: 6px 12px; align-items: center; max-width: 620px; }
.mapgrid .req { font-weight: 600; }
.preview { overflow: auto; max-height: 220px; border: 1px solid var(--line); margin: 10px 0; }
.preview table { font-size: 11.5px; } .preview th { position: sticky; top: 0; }
@media (max-width: 900px) { .side { flex-basis: 100%; } .two-col { grid-template-columns: 1fr; } .span2 { grid-column: span 1; } }

/* ---- assessment */
.kpi.score .v .of { font-size: 12px; color: var(--muted); margin-left: 2px; }
.s1 .v, .s2 .v, .s3 .v, .grade.s1, .grade.s2, .grade.s3, .dial.s1, .dial.s2, .dial.s3, .fill.s1, .fill.s2, .fill.s3 { color: #b42318; }
.s4 .v, .s5 .v, .s6 .v, .grade.s4, .grade.s5, .grade.s6, .dial.s4, .dial.s5, .dial.s6, .fill.s4, .fill.s5, .fill.s6 { color: #b54708; }
.s7 .v, .s8 .v, .grade.s7, .grade.s8, .dial.s7, .dial.s8, .fill.s7, .fill.s8 { color: #6b8e23; }
.s9 .v, .s10 .v, .grade.s9, .grade.s10, .dial.s9, .dial.s10, .fill.s9, .fill.s10 { color: #067647; }
.tab .count.sc1, .tab .count.sc2, .tab .count.sc3 { background: #b42318; } .tab .count.sc4, .tab .count.sc5, .tab .count.sc6 { background: #b54708; }
.tab .count.sc7, .tab .count.sc8 { background: #6b8e23; } .tab .count.sc9, .tab .count.sc10 { background: #067647; }
.assess-head { display: flex; gap: 22px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.assess-head .dial { flex: 0 0 auto; }
.assess-head .grade { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.assess-head .verdict { font-size: 15px; line-height: 1.45; margin: 4px 0 8px; }
.dims { flex: 0 0 300px; }
.dimscore { display: grid; grid-template-columns: 150px 1fr 24px; gap: 8px; align-items: center; font-size: 12px; margin: 5px 0; }
.dimscore .dbar { height: 8px; background: #edf0f4; border-radius: 4px; overflow: hidden; display: block; }
.dimscore .fill { display: block; height: 100%; background: currentColor; border-radius: 4px; }
.dimscore .dv { text-align: right; font-weight: 600; }
.finding { border: 1px solid var(--line); border-left: 4px solid #9aa5b1; border-radius: 5px; padding: 10px 12px; margin: 8px 0; background: #fff; }
.finding.sev-critical { border-left-color: #b42318; background: #fff8f7; }
.finding.sev-high { border-left-color: #d92d20; }
.finding.sev-medium { border-left-color: #f79009; }
.finding.sev-low { border-left-color: #c8a951; }
.finding.sev-info { border-left-color: #98a2b3; }
.finding.sev-good { border-left-color: #12b76a; background: #f6fef9; }
.finding .fhead { margin-bottom: 4px; font-size: 14px; }
.finding .fdetail { margin: 2px 0 4px; }
.finding .fwhy { color: #374151; font-size: 12.5px; }
.finding ul.fev { margin: 6px 0 0 18px; font-size: 12px; color: #374151; }
.sev { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; padding: 1px 6px; border-radius: 3px; color: #fff; background: #9aa5b1; vertical-align: middle; }
.sev.critical { background: #b42318; } .sev.high { background: #d92d20; } .sev.medium { background: #f79009; } .sev.low { background: #c8a951; } .sev.info { background: #98a2b3; } .sev.good { background: #12b76a; }
.good { color: #067647; font-weight: 600; }
table.market td.headlines { max-width: 380px; font-size: 11.5px; }
table.market td.headlines div { margin-bottom: 2px; }

/* ---- polish: dashboard, empty states, help text, sortable tables */
.scorechip { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 12px; font-weight: 700; font-size: 12px; color: #fff; background: #9aa5b1; }
.scorechip.s1, .scorechip.s2, .scorechip.s3 { background: #b42318; } .scorechip.s4, .scorechip.s5, .scorechip.s6 { background: #b54708; }
.scorechip.s7, .scorechip.s8 { background: #6b8e23; } .scorechip.s9, .scorechip.s10 { background: #067647; }
.empty { padding: 28px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 6px; margin-top: 12px; }
.empty .empty-title { font-size: 16px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.help { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
ol.steps { padding-left: 18px; } ol.steps li { margin-bottom: 5px; }
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable::after { content: ' ↕'; opacity: .35; font-size: 10px; }
table.grid th.sortable.asc::after { content: ' ↑'; opacity: 1; } table.grid th.sortable.desc::after { content: ' ↓'; opacity: 1; }
table.holdings thead th { position: sticky; top: 0; z-index: 1; }
tr[data-href] td a { text-decoration: none; }
.btn[disabled] { opacity: .6; cursor: progress; }
.kpi.score { border-top-color: currentColor; }
.stepcard { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; padding: 10px 0; }
.stepcard .n { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }

table.market details summary { cursor: pointer; font-size: 11px; }

/* ---- navigation: sticky tabs, side-scrolling tables, sticky first column */
.tabs.sticky { position: sticky; top: 0; z-index: 8; background: var(--bg); padding-top: 4px; }
.tablewrap { overflow-x: auto; max-width: 100%; border-radius: 4px; -webkit-overflow-scrolling: touch;
  background: linear-gradient(to right, #fff 30%, rgba(255,255,255,0)), linear-gradient(to right, rgba(255,255,255,0), #fff 70%) 100% 0,
              radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.12), rgba(0,0,0,0)), radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), rgba(0,0,0,0)) 100% 0;
  background-repeat: no-repeat; background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%; background-attachment: local, local, scroll, scroll; }
.tablewrap.tall { max-height: 72vh; overflow: auto; }
.tablewrap.tall thead th { position: sticky; top: 0; z-index: 2; }
.tablewrap table.grid { min-width: 100%; }
table.grid.holdings, table.grid.matrix { white-space: nowrap; }
table.grid.holdings td.small { white-space: normal; min-width: 180px; }
table.sticky-first th:first-child, table.sticky-first td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line); }
table.sticky-first thead th:first-child { z-index: 3; background: #fafbfc; }
table.sticky-first tr.group td:first-child { background: #eef2f7; }
table.sticky-first tr.total td:first-child, table.sticky-first tfoot td:first-child { background: #f5f7fa; }
table.matrix th.acct { text-align: center; border-left: 1px solid var(--line); }
table.matrix td.pc { color: var(--muted); border-right: 1px solid #eef1f4; }
.toolbar { margin-bottom: 10px; gap: 8px; }
#totop { position: fixed; right: 18px; bottom: 18px; z-index: 30; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
body.drawer-open .container { padding-right: min(580px, 45vw); }
@media (max-width: 1100px) { body.drawer-open .container { padding-right: 20px; } }

/* ---- statement date in the page header */
.subhead { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
label.stmtdate { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
label.stmtdate input { display: inline-block; width: auto; margin: 0; padding: 2px 6px; }
label.stmtdate.missing { border-color: #f79009; background: #fffaeb; }

/* ---- reasoning for each confidence rating */
button.badge.why { border: none; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; }
tr.whyrow td { background: #f8fafc !important; }
.whybox { font-size: 12.5px; line-height: 1.45; white-space: normal; max-width: 1100px; padding: 2px 4px; }
.reg { font-size: 12px; }

/* ---- registrations tree */
.taxstrip { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.taxbox { flex: 1; min-width: 180px; border: 1px solid var(--line); border-left: 4px solid #98a2b3; border-radius: 6px; padding: 8px 12px; background: #fff; }
.taxbox .l { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.taxbox .v { font-size: 18px; font-weight: 600; color: var(--primary); }
.taxbox.tx-taxable { border-left-color: #b54708; } .taxbox.tx-tax-deferred { border-left-color: #1f6feb; } .taxbox.tx-tax-exempt { border-left-color: #067647; }
table.tree tr.lvl0 td { background: #eef2f7; font-weight: 500; cursor: pointer; }
table.tree tr.lvl1 td { background: #f8fafc; cursor: pointer; }
table.tree tr.lvl1 td:first-child { padding-left: 26px; }
table.tree tr.lvl2 td:first-child { padding-left: 50px; }
table.tree .caret { display: inline-block; width: 12px; transition: transform .15s; color: var(--muted); }
table.tree tr.open > td .caret { transform: rotate(90deg); }
table.tree select.taxsel { display: inline-block; width: auto; padding: 2px 4px; margin: 0; font-size: 12px; }

/* ---- edit panel sections and account line */
.formsec { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--primary); font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 3px; margin-top: 6px; }
.acctline { font-size: 12.5px; margin: -4px 0 10px; }
button.link { background: none; border: none; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.topnav button.link { color: #e8edf3; text-decoration: none; }

/* ---- dialogs */
dialog.modal { border: none; border-radius: 10px; padding: 0; width: min(720px, 94vw); box-shadow: 0 18px 50px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .35); }
.modalform { padding: 18px 20px; }
.modalform h3 { margin-top: 0; }
.newacct { grid-column: span 2; padding: 8px 10px; background: #f8fafc; border-radius: 6px; margin-bottom: 6px; }

/* ---- upload */
.mapsummary { padding: 8px 12px; border-radius: 6px; margin: 10px 0 4px; font-size: 13px; }
.mapsummary.ok { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.mapsummary.bad { background: #fffaeb; color: #b54708; border: 1px solid #fedf89; }

table.grid th.r { text-align: right; }
table.grid td.holdcell { min-width: 220px; max-width: 320px; white-space: normal; }
table.grid td.holdcell .hname { color: #374151; }
