:root{--bg:#f4f7fb;--card:#fff;--ink:#172033;--muted:#667085;--line:#e3e8ef;--accent:#315efb;--ok:#137a4b;--warn:#a45a00;--danger:#b42318}*{box-sizing:border-box}body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--ink)}a{color:var(--accent);text-decoration:none}.topbar{height:64px;background:#101828;color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:5}.brand{font-weight:700;display:flex;gap:10px;align-items:center}.brand a{color:#fff}.version{font-size:12px;color:#98a2b3}.topbar nav{display:flex;gap:18px}.topbar nav a{color:#d0d5dd}.container{max-width:1220px;margin:28px auto;padding:0 20px}.footer{max-width:1220px;margin:36px auto;padding:18px 20px;color:#98a2b3;font-size:12px}.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:20px;box-shadow:0 2px 8px rgba(16,24,40,.04)}.grid{display:grid;gap:16px}.grid.cols5{grid-template-columns:repeat(5,1fr)}.grid.cols4{grid-template-columns:repeat(4,1fr)}.grid.cols3{grid-template-columns:repeat(3,1fr)}.grid.cols2{grid-template-columns:repeat(2,1fr)}.metric strong{font-size:30px;display:block}.metric span{color:var(--muted);font-size:13px}.page-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.page-title h1{margin:0;font-size:28px}.subnav{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 20px}.subnav a{padding:9px 12px;background:#fff;border:1px solid var(--line);border-radius:8px;color:#344054}.subnav a.active{background:#eef4ff;border-color:#b2ccff;color:#1849a9}.btn{display:inline-block;border:0;background:var(--accent);color:#fff;padding:10px 14px;border-radius:9px;font-weight:600;cursor:pointer}.btn.secondary{background:#fff;color:#344054;border:1px solid var(--line)}.btn.danger{background:var(--danger)}input,select,textarea{width:100%;padding:10px 11px;border:1px solid #d0d5dd;border-radius:8px;background:#fff;color:#101828}label{font-size:13px;color:#475467;font-weight:600;display:block;margin-bottom:6px}.field{margin-bottom:14px}.help{font-size:12px;color:var(--muted);margin-top:5px}.table-wrap{overflow:auto;background:#fff;border:1px solid var(--line);border-radius:12px}table{border-collapse:collapse;width:100%;font-size:13px}th,td{padding:11px 12px;border-bottom:1px solid #eef2f6;text-align:left;vertical-align:top}th{background:#f8fafc;color:#475467;white-space:nowrap}.badge{display:inline-flex;padding:3px 7px;border-radius:999px;font-size:11px;background:#eef2f6;color:#475467}.badge.ok{background:#ecfdf3;color:#027a48}.badge.warning{background:#fffaeb;color:#b54708}.badge.danger{background:#fef3f2;color:#b42318}.badge.info{background:#eff8ff;color:#175cd3}.flash{padding:12px 14px;border-radius:9px;margin-bottom:16px}.flash.success{background:#ecfdf3;color:#027a48}.flash.error{background:#fef3f2;color:#b42318}.flash.info{background:#eff8ff;color:#175cd3}.empty{text-align:center;padding:36px;color:#667085}.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.stack{display:flex;flex-direction:column;gap:12px}.muted{color:var(--muted)}code{background:#f2f4f7;padding:2px 5px;border-radius:5px}.auth{max-width:440px;margin:80px auto}.notice{background:#fffaeb;border:1px solid #fedf89;color:#7a2e0e;padding:12px 14px;border-radius:10px}.progress{height:10px;background:#eaecf0;border-radius:99px;overflow:hidden}.progress span{height:100%;display:block;background:var(--accent)}@media(max-width:900px){.grid.cols5,.grid.cols4,.grid.cols3,.grid.cols2{grid-template-columns:1fr}.topbar{padding:0 14px}.topbar nav a:not(:last-child){display:none}.container{margin-top:18px}.page-title{align-items:flex-start;gap:12px;flex-direction:column}}
.why-details{min-width:220px}.why-details summary{cursor:pointer;color:#315efb;font-weight:600}.why-details ul{margin:8px 0 0;padding-left:18px;color:#667085}.why-details li{margin:4px 0}

/* v0.1.0.5.1 compact semantics UI */
.metrics-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}.metric-card{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px 16px;box-shadow:0 2px 8px rgba(16,24,40,.035)}.metric-card strong{font-size:25px;display:block;line-height:1.05}.metric-card span{font-size:12px;color:var(--muted)}.filter-card{padding-bottom:14px}.compact-filters .field{margin-bottom:4px}.filter-actions{display:flex;align-items:end;gap:10px;margin-top:8px;flex-wrap:wrap}.topic-filter{min-width:260px;max-width:360px;margin-bottom:0;flex:1}.btn-link{padding:9px 4px;color:#667085;font-size:13px}.advanced-filters{margin-top:12px;border-top:1px solid #eef2f6;padding-top:10px}.advanced-filters summary{cursor:pointer;color:#475467;font-size:13px;font-weight:600;user-select:none}.advanced-filter-grid{margin-top:12px}.semantics-table table{table-layout:auto;min-width:1040px}.semantics-table th,.semantics-table td{padding:10px 10px}.semantics-table .query-cell{min-width:230px;max-width:320px}.semantics-table .evidence-cell{min-width:145px}.semantics-table .detail-cell{width:92px}.compact-note{font-size:11px;line-height:1.25}.diagnostic-details summary{cursor:pointer;color:#315efb;font-weight:600;white-space:nowrap}.diagnostic-popover{min-width:290px;max-width:430px;padding:10px 0 3px;color:#475467}.diagnostic-popover>div{margin:5px 0}.reason-list ul{margin:5px 0 0;padding-left:18px}.reason-list li{margin:4px 0}.why-details{min-width:0}
@media(max-width:1050px){.metrics-strip{grid-template-columns:repeat(5,minmax(110px,1fr));overflow-x:auto;padding-bottom:2px}.metric-card{min-width:110px}.semantics-table{overflow-x:auto}}
@media(max-width:760px){.metrics-strip{grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}.metric-card:last-child{grid-column:span 2}.compact-filters,.advanced-filter-grid{grid-template-columns:1fr!important}.topic-filter{max-width:none;width:100%}.filter-actions{align-items:stretch}.filter-actions .btn{width:100%}.semantics-table table{min-width:940px}}


/* v0.1.0.5.2 viewport-safe diagnostics drawer */
.diagnostic-details[open] > .diagnostic-popover{
  position:fixed;
  top:82px;
  right:18px;
  z-index:40;
  width:min(520px,calc(100vw - 36px));
  max-width:calc(100vw - 36px);
  max-height:calc(100vh - 104px);
  overflow:auto;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:16px;
  box-shadow:0 18px 50px rgba(16,24,40,.24);
  color:#344054;
  overflow-wrap:anywhere;
  word-break:normal;
}
.diagnostic-drawer-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;padding-bottom:12px;margin-bottom:10px;border-bottom:1px solid #eef2f6}
.diagnostic-drawer-head strong{font-size:16px;color:#172033}
.diagnostic-query{font-size:12px;color:var(--muted);margin-top:4px;line-height:1.4;max-width:420px}
.diagnostic-close{border:1px solid var(--line);background:#fff;border-radius:8px;width:32px;height:32px;line-height:27px;font-size:22px;color:#667085;cursor:pointer;flex:0 0 auto}
.diagnostic-close:hover{background:#f8fafc;color:#101828}
.diagnostic-details[open] summary{color:#1849a9}
body:has(.diagnostic-details[open])::after{content:"";position:fixed;inset:64px 0 0 0;background:rgba(16,24,40,.08);z-index:30;pointer-events:none}
@media(max-width:700px){
  .diagnostic-details[open] > .diagnostic-popover{top:72px;right:10px;left:10px;width:auto;max-width:none;max-height:calc(100vh - 84px);padding:14px}
}


/* v0.1.2.1 cluster confidence + drilldown */
.cluster-table table{min-width:1180px}
.cluster-table th,.cluster-table td{padding:9px 10px}
.cluster-label-cell{min-width:230px;max-width:310px}
.cluster-filters{padding-bottom:14px}
.cluster-details[open] > .cluster-drawer{
  width:min(780px,calc(100vw - 36px));
  max-width:calc(100vw - 36px);
}
.cluster-drawer-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;margin-bottom:12px}
.cluster-reason{margin:9px 0;line-height:1.45}
.cluster-mini-notice{margin:10px 0;padding:9px 11px}
.cluster-member-list{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.cluster-member{border:1px solid #eef2f6;border-radius:9px;padding:9px 10px;background:#f8fafc}
.cluster-member-query{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.cluster-member-signals{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin-top:6px;font-size:12px;color:#667085}
@media(max-width:760px){
  .cluster-drawer-grid{grid-template-columns:1fr}
  .cluster-member-query{display:block}
  .cluster-table table{min-width:1080px}
}

/* v0.1.2.2 Mega-Cluster Split Guard */
.cluster-mega-notice{margin:10px 0;padding:9px 11px;background:#fef3f2;border-color:#fecdca;color:#912018}
.modifier-chip-list{display:flex;gap:7px;flex-wrap:wrap;margin:8px 0 14px}
.modifier-chip{display:inline-flex;align-items:center;padding:5px 8px;border-radius:999px;background:#eff8ff;color:#175cd3;font-size:12px;border:1px solid #d1e9ff}
.modifier-chip.muted-chip{background:#f8fafc;color:#667085;border-color:#eaecf0}
.outlier-list{display:flex;flex-direction:column;gap:7px;margin:8px 0 14px}
.outlier-row{display:flex;justify-content:space-between;gap:12px;border:1px solid #f2f4f7;background:#fff8f7;border-radius:8px;padding:8px 9px;font-size:12px}
.outlier-row span{color:#667085;white-space:nowrap}
@media(max-width:760px){.outlier-row{display:block}.outlier-row span{display:block;margin-top:4px;white-space:normal}}

/* v0.1.3.0 ownership mapping */
.ownership-candidates{min-width:360px;max-width:620px;padding:8px 0}.ownership-candidate{border-bottom:1px solid #eef2f6;padding:8px 0}.ownership-candidate:last-child{border-bottom:0}.ownership-candidate strong{display:block;margin-bottom:4px}


/* v0.1.3.0.1 Sticky Cluster Action + Right-Edge Visibility Guard */
.cluster-table{
  position:relative;
  overflow:auto;
}
.cluster-table table{
  min-width:1080px;
}
.cluster-table th,.cluster-table td{
  padding:8px 8px;
}
.cluster-table th:nth-child(3),.cluster-table td:nth-child(3),
.cluster-table th:nth-child(4),.cluster-table td:nth-child(4),
.cluster-table th:nth-child(6),.cluster-table td:nth-child(6),
.cluster-table th:nth-child(7),.cluster-table td:nth-child(7),
.cluster-table th:nth-child(8),.cluster-table td:nth-child(8),
.cluster-table th:nth-child(9),.cluster-table td:nth-child(9),
.cluster-table th:nth-child(10),.cluster-table td:nth-child(10){
  white-space:nowrap;
}
.cluster-table th:nth-child(9),.cluster-table td:nth-child(9){min-width:74px;width:74px}
.cluster-table th:nth-child(10),.cluster-table td:nth-child(10){min-width:86px;width:86px}
.cluster-table th:nth-child(11),.cluster-table td:nth-child(11){min-width:132px;max-width:150px}

.cluster-table .cluster-action-col{
  position:sticky;
  right:0;
  z-index:3;
  min-width:88px;
  width:88px;
  max-width:88px;
  background:#fff;
  box-shadow:-12px 0 18px -18px rgba(16,24,40,.65);
  white-space:nowrap;
}
.cluster-table thead .cluster-action-col{
  z-index:6;
  background:#f8fafc;
}
.cluster-table .cluster-action-col summary{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:5px 7px;
  border:1px solid #dbe4f0;
  border-radius:7px;
  background:#fff;
  color:#315efb;
  line-height:1;
}
.cluster-table .cluster-action-col summary:hover{
  background:#f4f7ff;
  border-color:#b2ccff;
}
.cluster-table .cluster-action-col summary::marker{font-size:10px}

/* Ownership tables use the same right-edge action truth. */
.ownership-table{
  position:relative;
  overflow:auto;
}
.ownership-table table{
  min-width:980px;
}
.ownership-table th,.ownership-table td{
  padding:9px 9px;
}
.ownership-table th:nth-child(4),.ownership-table td:nth-child(4){
  min-width:210px;
  max-width:280px;
  overflow-wrap:anywhere;
}
.ownership-table th:nth-child(5),.ownership-table td:nth-child(5),
.ownership-table th:nth-child(6),.ownership-table td:nth-child(6),
.ownership-table th:nth-child(7),.ownership-table td:nth-child(7){
  width:62px;
  min-width:62px;
  white-space:nowrap;
}
.ownership-table .ownership-action-col{
  position:sticky;
  right:0;
  z-index:3;
  min-width:84px;
  width:84px;
  max-width:84px;
  background:#fff;
  box-shadow:-12px 0 18px -18px rgba(16,24,40,.65);
  white-space:nowrap;
}
.ownership-table thead .ownership-action-col{
  z-index:6;
  background:#f8fafc;
}
.ownership-table .ownership-action-col summary{
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:5px 7px;
  border:1px solid #dbe4f0;
  border-radius:7px;
  background:#fff;
  color:#315efb;
  font-weight:600;
  line-height:1;
}
.ownership-table .ownership-action-col summary:hover{
  background:#f4f7ff;
  border-color:#b2ccff;
}
.ownership-table .ownership-action-col summary::marker{font-size:10px}

@media(max-width:760px){
  .cluster-table table{min-width:1020px}
  .ownership-table table{min-width:920px}
  .cluster-table .cluster-action-col{min-width:82px;width:82px;max-width:82px}
  .ownership-table .ownership-action-col{min-width:82px;width:82px;max-width:82px}
}


/* v0.1.3.1 Ownership Evidence Inspector */
.ownership-inspector{min-width:min(680px,calc(100vw - 80px))}
.ownership-score-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:6px 10px;
  margin:7px 0;
  font-size:12px;
  color:#667085;
}
.ownership-score-grid span{
  background:#f8fafc;
  border:1px solid #eef2f6;
  border-radius:7px;
  padding:5px 7px;
}
.ownership-table th:nth-child(5),.ownership-table td:nth-child(5),
.ownership-table th:nth-child(6),.ownership-table td:nth-child(6),
.ownership-table th:nth-child(7),.ownership-table td:nth-child(7),
.ownership-table th:nth-child(8),.ownership-table td:nth-child(8){
  min-width:58px;
  width:58px;
}
.ownership-table th:nth-child(9),.ownership-table td:nth-child(9){min-width:135px}
@media(max-width:760px){
  .ownership-score-grid{grid-template-columns:1fr 1fr}
  .ownership-inspector{min-width:min(620px,calc(100vw - 32px))}
}


/* v0.1.4.0 SEO Opportunity Board */
.opportunity-table{position:relative;overflow:auto}
.opportunity-table table{min-width:1180px}
.opportunity-table th,.opportunity-table td{padding:8px 9px;vertical-align:top}
.opp-decision-form{display:flex;gap:5px;align-items:center}
.opp-decision-form select{min-width:96px;padding:5px 6px}
.btn.tiny{padding:5px 7px;font-size:12px}
.opportunity-table .opportunity-action-col{
  position:sticky;right:0;z-index:3;min-width:84px;width:84px;max-width:84px;background:#fff;
  box-shadow:-12px 0 18px -18px rgba(16,24,40,.65);white-space:nowrap
}
.opportunity-table thead .opportunity-action-col{z-index:6;background:#f8fafc}
.opportunity-table .opportunity-action-col summary{
  display:inline-flex;align-items:center;min-height:30px;padding:5px 7px;border:1px solid #dbe4f0;border-radius:7px;
  background:#fff;color:#315efb;font-weight:600;line-height:1
}
.opportunity-drawer{width:min(860px,calc(100vw - 36px));max-width:calc(100vw - 36px)}
.opportunity-spec-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;margin-bottom:12px}
.compact-list{margin:7px 0 12px;padding-left:20px}
.compact-list li{margin:4px 0;line-height:1.4}
.opportunity-query-list{display:flex;flex-direction:column;gap:6px;margin:8px 0 12px}
.opportunity-query-row{display:flex;justify-content:space-between;gap:14px;border:1px solid #eef2f6;background:#f8fafc;border-radius:8px;padding:7px 9px}
.opportunity-query-row .muted{text-align:right;font-size:12px}
.opportunity-merge-note{margin:10px 0}
.opportunity-operator-panel{border-top:1px solid #e5e7eb;margin-top:14px;padding-top:12px}
.opportunity-operator-panel textarea{width:100%;resize:vertical}
@media(max-width:760px){
  .opportunity-spec-grid{grid-template-columns:1fr}
  .opportunity-query-row{display:block}
  .opportunity-query-row .muted{display:block;text-align:left;margin-top:4px}
  .opportunity-table table{min-width:1080px}
}


/* v0.1.4.0.1 Drawer Layer Guard
   Sticky action cells must never paint over an open fixed diagnostic drawer. */
body:has(.opportunity-details[open]) .opportunity-table .opportunity-action-col{
  z-index:1;
}
body:has(.opportunity-details[open]) .opportunity-table thead .opportunity-action-col{
  z-index:2;
}
.opportunity-table .opportunity-action-col:has(.opportunity-details[open]){
  z-index:60;
}
.opportunity-details[open] > .opportunity-drawer{
  z-index:70;
}

/* Same protection for cluster drawers so the right-edge sticky action
   cannot regress when wider diagnostic content is added later. */
body:has(.cluster-details[open]) .cluster-table .cluster-action-col{
  z-index:1;
}
body:has(.cluster-details[open]) .cluster-table thead .cluster-action-col{
  z-index:2;
}
.cluster-table .cluster-action-col:has(.cluster-details[open]){
  z-index:60;
}
.cluster-details[open] > .cluster-drawer{
  z-index:70;
}


/* v0.1.4.0.2 Drawer Occlusion Guard
   Root cause: the fixed drawer lives inside a sticky table cell.
   Merely increasing z-index is not reliable because other sticky cells
   are separate table stacking/painting contexts. While any diagnostic
   drawer is open, remove sticky positioning from action cells and hide
   inactive action controls completely. */
body.diagnostic-open::after{
  content:"";
  position:fixed;
  inset:64px 0 0 0;
  background:rgba(16,24,40,.08);
  z-index:30;
  pointer-events:none;
}

/* Opportunity Board */
body.diagnostic-open .opportunity-table .opportunity-action-col{
  position:static !important;
  z-index:auto !important;
  box-shadow:none !important;
}
body.diagnostic-open .opportunity-table .opportunity-details:not([open]) > summary{
  visibility:hidden !important;
  pointer-events:none !important;
}
body.diagnostic-open .opportunity-details[open] > .opportunity-drawer{
  position:fixed !important;
  z-index:200 !important;
}

/* Demand Clusters */
body.diagnostic-open .cluster-table .cluster-action-col{
  position:static !important;
  z-index:auto !important;
  box-shadow:none !important;
}
body.diagnostic-open .cluster-table .cluster-details:not([open]) > summary{
  visibility:hidden !important;
  pointer-events:none !important;
}
body.diagnostic-open .cluster-details[open] > .cluster-drawer{
  position:fixed !important;
  z-index:200 !important;
}

/* Generic diagnostic drawers use the same top layer. */
body.diagnostic-open .diagnostic-details[open] > .diagnostic-popover{
  z-index:200 !important;
}


/* v0.1.4.1 Hub-Child Architecture / Business Fact Gate */
.business-facts-card{border-left:4px solid #d0d5dd}
.business-fact-form .checkline{display:inline-flex;align-items:center;gap:7px;margin:8px 12px 8px 0}
.business-fact-list{display:flex;flex-wrap:wrap;gap:7px;margin-top:10px}
.opportunity-table table{min-width:1240px}
.opportunity-table th:nth-child(2),.opportunity-table td:nth-child(2){min-width:92px}
.opportunity-table th:nth-child(3),.opportunity-table td:nth-child(3){min-width:140px}
.opportunity-table th:nth-child(5),.opportunity-table td:nth-child(5){min-width:125px}
.opportunity-table th:nth-child(6),.opportunity-table td:nth-child(6){min-width:125px}

/* v0.1.5.0.1 Russian Operator UI */
.tech-hint{display:inline-block;margin-left:6px;font-size:11px;font-weight:500;color:#98a2b3;white-space:nowrap}
.operator-note{font-size:12px;color:#667085;line-height:1.45}
